[英]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.按照gatsby wordpress 教程中的步骤,我将必要的插件添加到我的 wordpress 并创建了 gatsby 代码。 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.
发出 GraphQL 请求时返回空字符串而不是响应。 This may indicate that you have a WordPress filter running which is causing WPGraphQL to return an empty string instead of a response.
这可能表明您正在运行 WordPress 过滤器,这会导致 WPGraphQL 返回空字符串而不是响应。 Please open an issue with a reproduction at https://github.com/gatsbyjs/gatsby/issues/new for more help
请在https://github.com/gatsbyjs/gatsby/issues/new打开一个带有复制的问题以获得更多帮助
Error occurred while updating a single "post" node.
更新单个“post”节点时出错。
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
类型错误:无法在 fetchAndCreateSingleNode 处读取未定义的属性“post”(/Users/bbt/Documents/Work/my-wordpress-gatsby-site-2/node_modules/gatsby-source-wordpress/src/steps/source-nodes/update-节点/wp-actions/update.js:76:24) 在 processTicksAndRejections (internal/process/task_queues.js:95:5) 在 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) 在 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) 在 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) 在 fetchAndApplyNodeUpdates (/Users/bbt/Documents /工作/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)
.js:44:36) 在 sourceNodes (/Users/bbt/Documents/Work/my-wordpress-gatsby-site-2/node_modules/gatsby-source-wordpress/src/steps/source-nodes/index.ts:60 :5) 在 runSteps (/Users/bbt/Documents/Work/my-wordpress-gatsby-site-2/node_modules/gatsby-source-wordpress/src/utils/run-steps.ts:41:9) 在 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_112003
gatsby-source-wordpress
盖茨比源 wordpress
Encountered a critical error when running the sourceNodes.sourceNodes build step.
运行 sourceNodes.sourceNodes 构建步骤时遇到严重错误。 See above for more information.
有关更多信息,请参见上文。
Relevant gatsby-config.js:相关的 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.我可以毫无问题地查询 wordpress graphQL 中的帖子节点,它们在那里。
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.
它的工作原理是因为插件已关闭。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.