迁移到 GatsbyJS v3,来自 gatsby-source-wordpress "Found a duplicate ID in WordPress" 的奇怪错误
Migrating to GatsbyJS v3, strange error from gatsby-source-wordpress "Found a duplicate ID in WordPress"
我刚刚将我的 Gatsby 更新到 v3。就在那之前,我刚刚将 gatsby-source-wordpress 更新到 v5,一切都在 Gatsby v2.32.9
上运行
现在在执行 gatsby develop
时,我收到以下消息:
info gatsby-source-wordpress
This is either your first build or the cache was cleared.
Please wait while your WordPress data is synced to your Gatsby cache.
Maybe now's a good time to get up and stretch? :D
success gatsby-source-wordpress ingest WPGraphQL schema - 2.619s
success createSchemaCustomization - 4.169s
ERROR
(node:23740) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
success gatsby-source-wordpress fetch root fields - 0.730s
success gatsby-source-wordpress Comment - 0.853s - fetched 0
success gatsby-source-wordpress MenuItem - 1.389s - fetched 1
success gatsby-source-wordpress ContentType - 2.484s - fetched 3
success gatsby-source-wordpress Category - 4.662s - fetched 25
success gatsby-source-wordpress PostFormat - 0.770s - fetched 1
success gatsby-source-wordpress Menu - 0.792s - fetched 1
success gatsby-source-wordpress Page - 0.996s - fetched 4
success gatsby-source-wordpress Tag - 5.938s - fetched 88
success gatsby-source-wordpress Post - 19.975s - fetched 367
success gatsby-source-wordpress UserRole - 0.943s - fetched 0
success gatsby-source-wordpress Taxonomy - 1.459s - fetched 3
success gatsby-source-wordpress User - 3.036s - fetched 11
warn gatsby-source-wordpress Found a duplicate ID in WordPress - this means you will have fewer nodes in Gatsby than in WordPress. This will need to
be resolved in WP by identifying and fixing the underlying bug with your WP plugins or custom code.
info pushing Media Item query #0, digest: de78a8ecdd99c9e43936d44ad88871f0 to the end of the request queue.
info Previously retried 2 times already.
info pushing Media Item query #0, digest: de78a8ecdd99c9e43936d44ad88871f0 to the end of the request queue.
info Previously retried 3 times already.
info pushing Media Item query #0, digest: de78a8ecdd99c9e43936d44ad88871f0 to the end of the request queue.
info Previously retried 4 times already.
info
already re-queued Media Item query #0, digest: de78a8ecdd99c9e43936d44ad88871f0 5 times :( sorry.
Try lowering process.env.GATSBY_CONCURRENT_DOWNLOAD.
It's currently set to 1
ERROR
There was an error
not finished source and transform nodes - 51.476s
not finished gatsby-source-wordpress fetching nodes - 48.144s - 517 total
not finished gatsby-source-wordpress creating nodes - 20.447s
not finished gatsby-source-wordpress MediaItem - 20.450s - fetched 13
not finished Downloading remote files - 18.767s
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
我的依赖如下:
"dependencies": {
"cross-env": "^7.0.2",
"gatsby": "^3.1.1",
"gatsby-image": "^2.10.0",
"gatsby-plugin-alias-imports": "^1.0.5",
"gatsby-plugin-catch-links": "^3.1.0",
"gatsby-plugin-feed": "^3.1.0",
"gatsby-plugin-gatsby-cloud": "^2.1.0",
"gatsby-plugin-google-tagmanager": "^3.1.0",
"gatsby-plugin-manifest": "^3.1.0",
"gatsby-plugin-meta-redirect": "^1.1.1",
"gatsby-plugin-offline": "^4.1.0",
"gatsby-plugin-react-helmet": "^4.1.0",
"gatsby-plugin-remove-serviceworker": "^1.0.0",
"gatsby-plugin-sharp": "^2.13.1",
"gatsby-plugin-sitemap": "^3.1.0",
"gatsby-plugin-split-css": "^2.0.0",
"gatsby-remark-images": "^4.1.0",
"gatsby-source-filesystem": "^3.1.0",
"gatsby-source-wordpress": "^5.1.0",
"gatsby-source-youtube-v3": "^3.0.0",
"gatsby-transformer-remark": "^3.1.0",
"gatsby-transformer-sharp": "^3.1.0",
"graphql": "^15.4.0",
"i18n-react": "^0.7.0",
"prop-types": "^15.7.2",
"react": "^17.0.1",
"react-cookies": "^0.1.1",
"react-countup": "^4.2.3",
"react-dom": "^17.0.1",
"react-helmet": "^6.1.0",
"react-hubspot-form": "^1.3.7",
"react-lazyload": "2.6.9",
"react-responsive-carousel": "^3.1.51",
"react-scroll": "^1.7.14",
"react-share": "^4.2.0",
"react-sticky": "^6.0.3",
"react-swipeable": "^5.5.1",
"react-text-loop": "^2.3.0",
"react-typeform-embed": "^0.2.1"
},
"devDependencies": {
"gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.10",
"prettier": "^2.1.2",
"react-devtools": "^4.10.1"
},
我与 WPEngine 的代表进行了交谈,他们向我保证他们在帖子或用户表中找不到重复的 ID。
有没有人遇到过这种情况?现在我在想也许我应该升级 gatsby-image 插件,但我担心它会进一步崩溃,我将很难区分由 gatsby-image 引起的错误和由源代码引起的错误- WordPress.
没有找到永久解决方案,但找到了修复...
问题源于我的 gatsby-source-wordpress 与我的 Polylang WP 插件暴露给 GraphQL 的方式之间的冲突 API。基本上,“重复 ID”与第一个 post API 可以找到的翻译有关,但由于某种原因它中断了。在撰写本文时,这似乎特定于 gatsby-source-wordpress 版本 ^5.0.0 和 ^5.1.0。我的修复:恢复到 gatsby-source-wordpress 版本 ^4.1.0-next.1,它不会遇到同样的问题。
此修复适用于 Gatsby v3.1.1。
我刚刚将我的 Gatsby 更新到 v3。就在那之前,我刚刚将 gatsby-source-wordpress 更新到 v5,一切都在 Gatsby v2.32.9
上运行现在在执行 gatsby develop
时,我收到以下消息:
info gatsby-source-wordpress
This is either your first build or the cache was cleared.
Please wait while your WordPress data is synced to your Gatsby cache.
Maybe now's a good time to get up and stretch? :D
success gatsby-source-wordpress ingest WPGraphQL schema - 2.619s
success createSchemaCustomization - 4.169s
ERROR
(node:23740) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
success gatsby-source-wordpress fetch root fields - 0.730s
success gatsby-source-wordpress Comment - 0.853s - fetched 0
success gatsby-source-wordpress MenuItem - 1.389s - fetched 1
success gatsby-source-wordpress ContentType - 2.484s - fetched 3
success gatsby-source-wordpress Category - 4.662s - fetched 25
success gatsby-source-wordpress PostFormat - 0.770s - fetched 1
success gatsby-source-wordpress Menu - 0.792s - fetched 1
success gatsby-source-wordpress Page - 0.996s - fetched 4
success gatsby-source-wordpress Tag - 5.938s - fetched 88
success gatsby-source-wordpress Post - 19.975s - fetched 367
success gatsby-source-wordpress UserRole - 0.943s - fetched 0
success gatsby-source-wordpress Taxonomy - 1.459s - fetched 3
success gatsby-source-wordpress User - 3.036s - fetched 11
warn gatsby-source-wordpress Found a duplicate ID in WordPress - this means you will have fewer nodes in Gatsby than in WordPress. This will need to
be resolved in WP by identifying and fixing the underlying bug with your WP plugins or custom code.
info pushing Media Item query #0, digest: de78a8ecdd99c9e43936d44ad88871f0 to the end of the request queue.
info Previously retried 2 times already.
info pushing Media Item query #0, digest: de78a8ecdd99c9e43936d44ad88871f0 to the end of the request queue.
info Previously retried 3 times already.
info pushing Media Item query #0, digest: de78a8ecdd99c9e43936d44ad88871f0 to the end of the request queue.
info Previously retried 4 times already.
info
already re-queued Media Item query #0, digest: de78a8ecdd99c9e43936d44ad88871f0 5 times :( sorry.
Try lowering process.env.GATSBY_CONCURRENT_DOWNLOAD.
It's currently set to 1
ERROR
There was an error
not finished source and transform nodes - 51.476s
not finished gatsby-source-wordpress fetching nodes - 48.144s - 517 total
not finished gatsby-source-wordpress creating nodes - 20.447s
not finished gatsby-source-wordpress MediaItem - 20.450s - fetched 13
not finished Downloading remote files - 18.767s
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
我的依赖如下:
"dependencies": {
"cross-env": "^7.0.2",
"gatsby": "^3.1.1",
"gatsby-image": "^2.10.0",
"gatsby-plugin-alias-imports": "^1.0.5",
"gatsby-plugin-catch-links": "^3.1.0",
"gatsby-plugin-feed": "^3.1.0",
"gatsby-plugin-gatsby-cloud": "^2.1.0",
"gatsby-plugin-google-tagmanager": "^3.1.0",
"gatsby-plugin-manifest": "^3.1.0",
"gatsby-plugin-meta-redirect": "^1.1.1",
"gatsby-plugin-offline": "^4.1.0",
"gatsby-plugin-react-helmet": "^4.1.0",
"gatsby-plugin-remove-serviceworker": "^1.0.0",
"gatsby-plugin-sharp": "^2.13.1",
"gatsby-plugin-sitemap": "^3.1.0",
"gatsby-plugin-split-css": "^2.0.0",
"gatsby-remark-images": "^4.1.0",
"gatsby-source-filesystem": "^3.1.0",
"gatsby-source-wordpress": "^5.1.0",
"gatsby-source-youtube-v3": "^3.0.0",
"gatsby-transformer-remark": "^3.1.0",
"gatsby-transformer-sharp": "^3.1.0",
"graphql": "^15.4.0",
"i18n-react": "^0.7.0",
"prop-types": "^15.7.2",
"react": "^17.0.1",
"react-cookies": "^0.1.1",
"react-countup": "^4.2.3",
"react-dom": "^17.0.1",
"react-helmet": "^6.1.0",
"react-hubspot-form": "^1.3.7",
"react-lazyload": "2.6.9",
"react-responsive-carousel": "^3.1.51",
"react-scroll": "^1.7.14",
"react-share": "^4.2.0",
"react-sticky": "^6.0.3",
"react-swipeable": "^5.5.1",
"react-text-loop": "^2.3.0",
"react-typeform-embed": "^0.2.1"
},
"devDependencies": {
"gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.10",
"prettier": "^2.1.2",
"react-devtools": "^4.10.1"
},
我与 WPEngine 的代表进行了交谈,他们向我保证他们在帖子或用户表中找不到重复的 ID。
有没有人遇到过这种情况?现在我在想也许我应该升级 gatsby-image 插件,但我担心它会进一步崩溃,我将很难区分由 gatsby-image 引起的错误和由源代码引起的错误- WordPress.
没有找到永久解决方案,但找到了修复...
问题源于我的 gatsby-source-wordpress 与我的 Polylang WP 插件暴露给 GraphQL 的方式之间的冲突 API。基本上,“重复 ID”与第一个 post API 可以找到的翻译有关,但由于某种原因它中断了。在撰写本文时,这似乎特定于 gatsby-source-wordpress 版本 ^5.0.0 和 ^5.1.0。我的修复:恢复到 gatsby-source-wordpress 版本 ^4.1.0-next.1,它不会遇到同样的问题。
此修复适用于 Gatsby v3.1.1。