【发布时间】:2022-02-27 04:25:04
【问题描述】:
按照gatsby wordpress tutorial 的步骤,我将必要的插件添加到我的wordpress 并创建了 gatsby 代码。一切都正确获取,除了帖子,我收到以下错误:
发出 GraphQL 请求时返回空字符串而不是响应。 这可能表明您正在运行导致 WPGraphQL 的 WordPress 过滤器 返回一个空字符串而不是响应。 请打开一个复制问题 https://github.com/gatsbyjs/gatsby/issues/new 寻求更多帮助
更新单个“post”节点时出错。
错误
TypeError:无法读取未定义的属性“帖子” 在 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) 在 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/Work/my-wordpress-gatsby-site-2/node_modules/gatsby-source-wordpress/src/steps/source-nodes/update-nodes/fetch-node-updates.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)
错误 #gatsby-source-wordpress_112003
gatsby-source-wordpress
运行 sourceNodes.sourceNodes 构建步骤时遇到严重错误。 有关更多信息,请参见上文。
相关的 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 中查询帖子节点,它们就在那里。
任何想法如何调试这个?
【问题讨论】:
-
你发过帖子了吗?
-
@FerranBuireu 是的,我已经发布了帖子。
标签: javascript node.js wordpress gatsby