valu-digital / wp-graphql-polylang

WPGraphQL Polylang Extension for WordPress
https://packagist.org/packages/valu/wp-graphql-polylang
GNU General Public License v2.0
124 stars 20 forks source link

"Found a duplicate ID in WordPress" #43

Open lekevoid opened 3 years ago

lekevoid commented 3 years ago

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

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

EDIT : Added some details.

dannyvaughton commented 3 years ago

I am having the same issue.

lnikell commented 3 years ago

Experience the same issue with latest gatsby-source-wordpress@5.1.0 and WP Graphql Polylang

esamattis commented 3 years ago

Does it work if you downgrade to Polylang 2.x from 3.x?

sirichards commented 3 years ago

Also experiencing this issue!

nikolap994 commented 2 years ago

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.

Nekeres commented 1 year ago

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
);