简体   繁体   English

gatsby-source-wordpress 错误:“发出 GraphQL 请求时返回了空字符串而不是响应。”

[英]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.

相关问题 Gatsby WordPress来源-GraphQl在不使用时忽略了灵活的内容布局 - Gatsby WordPress Source - Flexible Content layouts ignored by graphql when not used gatsby-source-wordpress:netlify deploy 上 ACF 字段中图像的 localFile 字段为 null - gatsby-source-wordpress: localFile field null on images in ACF fields on netlify deploy gatsby-source-graphql和GraphQL Shopify Admin API错误 - gatsby-source-graphql and GraphQL Shopify Admin API error 嵌入内联JS脚本而不是发出AJAX请求。 为什么? - Embedding inline JS script instead of making an AJAX request. Why? GraphQL 中的 Gatsby pageContext 为空 - Gatsby pageContext empty in GraphQL 在 Zeit 上使用 gatsby-source-buttercms 部署 gatsby 应用程序时出错 - Error when deploying the gatsby app with gatsby-source-buttercms on Zeit MongoDB 发起POST请求时返回空错误Object - MongoDB Returns Empty Error Object when Making POST Request 为什么用空字符串作为搜索参数进行get请求会导致返回随机数据而不是无数据? - why does making get request with empty string as search param results in returning random data instead of no data? 错误“gatsby-source-graphql”在运行 sourceNodes 生命周期时引发错误: - error "gatsby-source-graphql" threw an error while running the sourceNodes lifecycle: gatsby-source-shopify 和 graphql 错误 采购数据时发生错误 - gatsby-source-shopify and graphql error an error occurred while sourcing data
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM