wp-graphql-polylang
wp-graphql-polylang copied to clipboard
"Found a duplicate ID in WordPress"
Description
We have a GatsbyJS site using gatsby-source-wordpress.
When launching gatsby develop, I get the error message : "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.
"
The problem goes away if I disable WP GraphQL Polylang ; of course then my Gatsby translation modules break.
Steps to reproduce
- Minimal reproduction here : https://github.com/lekevoid/minimal-test
- Do
yarn develop
orgatsby develop
- See the error message mentioned above.
Expected result
The develop should launch properly.
Actual result
Get the error message mentioned above, and the dev server breaks.
Environment
System:
OS: Windows 10 10.0.17763
CPU: (8) x64 Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
Binaries:
Node: 12.18.3 - C:\Program Files\nodejs\node.EXE
Yarn: 1.17.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.14.6 - C:\Program Files\nodejs\npm.CMD
Languages:
Python: 3.8.5
Browsers:
Chrome: 89.0.4389.90
Edge: Spartan (44.17763.831.0)
npmPackages:
gatsby: ^3.1.1 => 3.1.1
gatsby-image: ^2.10.0 => 2.11.0
gatsby-plugin-alias-imports: ^1.0.5 => 1.0.5
gatsby-plugin-catch-links: ^3.1.0 => 3.1.0
gatsby-plugin-feed: ^3.1.0 => 3.1.0
gatsby-plugin-gatsby-cloud: ^2.1.0 => 2.1.0
gatsby-plugin-google-tagmanager: ^3.1.0 => 3.1.0
gatsby-plugin-manifest: ^3.1.0 => 3.1.0
gatsby-plugin-meta-redirect: ^1.1.1 => 1.1.1
gatsby-plugin-offline: ^4.1.0 => 4.1.0
gatsby-plugin-react-helmet: ^4.1.0 => 4.1.0
gatsby-plugin-remove-serviceworker: ^1.0.0 => 1.0.0
gatsby-plugin-sharp: ^2.13.1 => 2.14.3
gatsby-plugin-sitemap: ^3.1.0 => 3.1.0
gatsby-plugin-split-css: ^2.0.0 => 2.0.0
gatsby-plugin-webpack-bundle-analyser-v2: ^1.1.10 => 1.1.21
gatsby-remark-images: ^4.1.0 => 4.1.0
gatsby-source-filesystem: ^3.1.0 => 3.1.0
gatsby-source-wordpress: ^5.1.0 => 5.1.0
gatsby-source-youtube-v3: ^3.0.0 => 3.0.0
gatsby-transformer-remark: ^3.1.0 => 3.1.0
gatsby-transformer-sharp: ^3.1.0 => 3.1.0
npmGlobalPackages:
gatsby-cli: 3.1.0
Our WP Plugins are :
Advanced Custom Fields, Version 5.9.5 Co-Authors Plus, Version 3.4.3 Genesis Custom Blocks, Version 1.1.0 More Fields, Version 2.1 Polylang, Version 3.0.3 WordPress Importer, Version 0.7 WP Gatsby, Version 1.0.6 WP GraphQL, Version 1.3.2 WP GraphQL Polylang, Version 0.5.0 WP REST - Polylang, Version 1.0.0 Yoast SEO Premium, Version 7.5.2
What has been tried so far
- Updating all my plugins, both in Gatsby and in WP.
- Contacting our WP host : there's no actual duplicate IDs in the database. Plus, the problem disappears if I disable the WP GraphQL Polylang plugin, so this seems to be closer to the root cause.
- The problem seems to lie specifically with the MediaItem ID #35306 ; which, I believe, is just the feature image for the first post that's detected that has a translation.
- Lower GATSBY_CONCURRENT_DOWNLOAD ; it's set to 1 and still doesn't help.
- Tinker with the gatsby-source-wordpress plugin : the error message comes from the file /dist/steps/source-nodes/fetch-nodes/fetch-nodes-paginated.js, line 117. I was able to get the dev server to run once by commenting out the whole line 117. Haven't been able to do it twice though. Playing with that file is also how I isolated the MediaItem #35306 as being problematic (by console-logging the
node.databaseId
.)
EDIT : Added some details.
I am having the same issue.
Experience the same issue with latest [email protected] and WP Graphql Polylang
Does it work if you downgrade to Polylang 2.x from 3.x?
Also experiencing this issue!
Any update on this issue, we're facing the same issue with "gatsby-source-wordpress": "^6.17.0", and v0.6.0 version of the plugin.
Hello, for me the problem was the WP GRAPHQL plugin. The default value of posts per page is 100 and if I exceeded this number of menu items, I got a message about duplicate. After changing the value to a larger one based filter, the problem was resolved. To be sure, also change the value of this parameter in the gatsby-source-wordpress configuration https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-wordpress/docs/plugin-options.md#schemaperpage
{
resolve: `gatsby-source-wordpress`,
options: {
schema: {
perPage: 300,
},
},
}
add_filter(
'graphql_connection_max_query_amount',
function( $amount, $source, $args, $context, $info ) {
$amount = 300;
return $amount;
},
10,
5
);