简体   繁体   中英

gatsby-source-wordpress error: "An empty string was returned instead of a response when making a GraphQL request."

Following the steps at the gatsby wordpress tutorial , I added the necessary plugins to my wordpress and created the gatsby code. Everything is properly fetched, except for posts, I receive the following error:

An empty string was returned instead of a response when making a GraphQL request. This may indicate that you have a WordPress filter running which is causing WPGraphQL to return an empty string instead of a response. Please open an issue with a reproduction at https://github.com/gatsbyjs/gatsby/issues/new for more help

Error occurred while updating a single "post" node.

ERROR

TypeError: Cannot read property 'post' of undefined at fetchAndCreateSingleNode (/Users/bbt/Documents/Work/my-wordpress-gatsby-site-2/node_modules/gatsby-source-wordpress/src/steps/source-nodes/update-nodes/wp-actions/update.js:76:24) at processTicksAndRejections (internal/process/task_queues.js:95:5) at wpActionUPDATE (/Users/bbt/Documents/Work/my-wordpress-gatsby-site-2/node_modules/gatsby-source-wordpress/src/steps/source-nodes/update-nodes/wp-actions/update.js:311:20) at handleWpActions (/Users/bbt/Documents/Work/my-wordpress-gatsby-site-2/node_modules/gatsby-source-wordpress/src/steps/source-nodes/update-nodes/wp-actions/index.js:60:7) at fetchAndRunWpActions (/Users/bbt/Documents/Work/my-wordpress-gatsby-site-2/node_modules/gatsby-source-wordpress/src/steps/source-nodes/update-nodes/wp-actions/index.js:102:7) at fetchAndApplyNodeUpdates (/Users/bbt/Documents/Work/my-wordpress-gatsby-site-2/node_modules/gatsby-source-wordpress/src/steps/source-nodes/update-nodes/fetch-node-updates .js:44:36) at sourceNodes (/Users/bbt/Documents/Work/my-wordpress-gatsby-site-2/node_modules/gatsby-source-wordpress/src/steps/source-nodes/index.ts:60:5) at runSteps (/Users/bbt/Documents/Work/my-wordpress-gatsby-site-2/node_modules/gatsby-source-wordpress/src/utils/run-steps.ts:41:9) at runAPI (/Users/bbt/Documents/Work/my-wordpress-gatsby-site-2/node_modules/gatsby/src/utils/api-runner-node.js:462:16)

ERROR #gatsby-source-wordpress_112003

gatsby-source-wordpress

Encountered a critical error when running the sourceNodes.sourceNodes build step. See above for more information.

Relevant gatsby-config.js:

resolve: `gatsby-source-wordpress`,
       options: {
         url:
           process.env.WPGRAPHQL_URL ||
           `https://BLOGURL.com/graphql`,
         auth: {
           htaccess: {
             username: `HTACCESS-USERNAME`,
             password: `HTACCESS-PASSWORD`,
           },
         },
         schema: {
           perPage: 5, // making it slow (suggested somewhere)
           requestConcurrency: 5, // making it slow (suggested somewhere)
           previewRequestConcurrency: 2, // making it slow (suggested somewhere)
         },
       },

I can query the post nodes in the wordpress graphQL without a problem, they are there.

Any ideas how to debug this?

I solved it the following way -- switched off all plugins and it worked. Switched them back one-by-one, and there was a certain plugin (something related to external links, so absolutely not something that was suspicious) that caused the problem. It works since the plugin is switched off.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM