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

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

按照 gatsby wordpress tutorial 中的步骤,我向我的 wordpress 添加了必要的插件并创建了 gatsby 代码。除 posts 外,所有内容均已正确获取,我收到以下错误:

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.

相关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)
         },
       },

我可以毫无问题地查询 wordpress graphQL 中的 post 个节点,它们就在那里。

有什么调试方法吗?

我通过以下方式解决了这个问题 -- 关闭了所有插件并且它起作用了。切换回来one-by-one,是某个插件(与外部链接有关的东西,所以绝对不是可疑的东西)导致了问题。它在插件关闭后有效。