Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WPGraphQL 0.14.0] Duplicate Type errors #356

Closed
jacobarriola opened this issue Oct 30, 2020 · 3 comments
Closed

[WPGraphQL 0.14.0] Duplicate Type errors #356

jacobarriola opened this issue Oct 30, 2020 · 3 comments

Comments

@jacobarriola
Copy link
Contributor

jacobarriola commented Oct 30, 2020

Describe the bug
After updating WPGraphQL from 0.13.x to 0.14.0, product queries return DUPLICATE_TYPE errors.

To Reproduce
Run the follow products query:

query Products {
  products {
    nodes {
      id
    }
  }
}

Expected behavior
The first 10 products should return.

Actual behavior
Products return along with an extensions debug array.

Screenshots

{
  "data": {
    "products": {
      "nodes": [
        {
          "id": "cHJvZHVjdDoyODY5OTU="
        },
        {
          "id": "cHJvZHVjdDoxMzk1Mjg="
        },
        {
          "id": "cHJvZHVjdDoyODY2Mjk="
        },
        {
          "id": "cHJvZHVjdDozNTA2NDQ="
        },
        {
          "id": "cHJvZHVjdDo0MDI4MzY="
        },
        {
          "id": "cHJvZHVjdDoxMTk3MzM="
        },
        {
          "id": "cHJvZHVjdDoxMTk1MDc="
        },
        {
          "id": "cHJvZHVjdDo0MDA0NDI="
        },
        {
          "id": "cHJvZHVjdDo0MDA0MjU="
        }
      ]
    }
  },
  "extensions": {
    "debug": [
      {
        "type": "DUPLICATE_TYPE",
        "message": "You cannot register duplicate Types to the Schema. The Type 'CouponToProductCategoryConnectionWhereArgs' already exists in the Schema. Make sure to give new Types a unique name.",
        "type_name": "CouponToProductCategoryConnectionWhereArgs",
        "stack": [
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/access-functions.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/SchemaRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/wp-graphql.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Request.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/functions.php",
          "/home/s36/html/wp-blog-header.php",
          "/home/s36/html/index.php"
        ]
      },
      {
        "type": "DUPLICATE_TYPE",
        "message": "You cannot register duplicate Types to the Schema. The Type 'CouponToProductCategoryConnectionEdge' already exists in the Schema. Make sure to give new Types a unique name.",
        "type_name": "CouponToProductCategoryConnectionEdge",
        "stack": [
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/access-functions.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/SchemaRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/wp-graphql.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Request.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/functions.php",
          "/home/s36/html/wp-blog-header.php",
          "/home/s36/html/index.php"
        ]
      },
      {
        "type": "DUPLICATE_TYPE",
        "message": "You cannot register duplicate Types to the Schema. The Type 'CouponToProductCategoryConnection' already exists in the Schema. Make sure to give new Types a unique name.",
        "type_name": "CouponToProductCategoryConnection",
        "stack": [
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/access-functions.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/SchemaRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/wp-graphql.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Request.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/functions.php",
          "/home/s36/html/wp-blog-header.php",
          "/home/s36/html/index.php"
        ]
      },
      {
        "type": "DUPLICATE_TYPE",
        "message": "You cannot register duplicate Types to the Schema. The Type 'CouponToProductConnectionWhereArgs' already exists in the Schema. Make sure to give new Types a unique name.",
        "type_name": "CouponToProductConnectionWhereArgs",
        "stack": [
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/access-functions.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/SchemaRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/wp-graphql.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Request.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/functions.php",
          "/home/s36/html/wp-blog-header.php",
          "/home/s36/html/index.php"
        ]
      },
      {
        "type": "DUPLICATE_TYPE",
        "message": "You cannot register duplicate Types to the Schema. The Type 'CouponToProductConnectionEdge' already exists in the Schema. Make sure to give new Types a unique name.",
        "type_name": "CouponToProductConnectionEdge",
        "stack": [
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/access-functions.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/SchemaRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/wp-graphql.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Request.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/functions.php",
          "/home/s36/html/wp-blog-header.php",
          "/home/s36/html/index.php"
        ]
      },
      {
        "type": "DUPLICATE_TYPE",
        "message": "You cannot register duplicate Types to the Schema. The Type 'CouponToProductConnection' already exists in the Schema. Make sure to give new Types a unique name.",
        "type_name": "CouponToProductConnection",
        "stack": [
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/access-functions.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/SchemaRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/wp-graphql.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Request.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/functions.php",
          "/home/s36/html/wp-blog-header.php",
          "/home/s36/html/index.php"
        ]
      },
      {
        "type": "DUPLICATE_TYPE",
        "message": "You cannot register duplicate Types to the Schema. The Type 'ProductToProductConnectionWhereArgs' already exists in the Schema. Make sure to give new Types a unique name.",
        "type_name": "ProductToProductConnectionWhereArgs",
        "stack": [
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/access-functions.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/SchemaRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/wp-graphql.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Request.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/functions.php",
          "/home/s36/html/wp-blog-header.php",
          "/home/s36/html/index.php"
        ]
      },
      {
        "type": "DUPLICATE_TYPE",
        "message": "You cannot register duplicate Types to the Schema. The Type 'ProductToProductConnectionEdge' already exists in the Schema. Make sure to give new Types a unique name.",
        "type_name": "ProductToProductConnectionEdge",
        "stack": [
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/access-functions.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/SchemaRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/wp-graphql.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Request.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/functions.php",
          "/home/s36/html/wp-blog-header.php",
          "/home/s36/html/index.php"
        ]
      },
      {
        "type": "DUPLICATE_TYPE",
        "message": "You cannot register duplicate Types to the Schema. The Type 'ProductToProductConnection' already exists in the Schema. Make sure to give new Types a unique name.",
        "type_name": "ProductToProductConnection",
        "stack": [
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/access-functions.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/SchemaRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/wp-graphql.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Request.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/functions.php",
          "/home/s36/html/wp-blog-header.php",
          "/home/s36/html/index.php"
        ]
      },
      {
        "type": "DUPLICATE_TYPE",
        "message": "You cannot register duplicate Types to the Schema. The Type 'ACF_Link' already exists in the Schema. Make sure to give new Types a unique name.",
        "type_name": "ACF_Link",
        "stack": [
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/access-functions.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/TypeRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Registry/SchemaRegistry.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/wp-graphql.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Request.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-content/mu-plugins/wp-graphql/src/Router.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/class-wp-hook.php",
          "/home/s36/html/wp-includes/plugin.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/class-wp.php",
          "/home/s36/html/wp-includes/functions.php",
          "/home/s36/html/wp-blog-header.php",
          "/home/s36/html/index.php"
        ]
      }
    ]
  }
}

Additional context
WPGraphQL: 0.14.0
WooGraphQL: develop branch
WooCommerce: 3.6
WordPress: 5.5.1

@dbertella
Copy link

Same issue here, I had to downgrade to WPGraphQL v0.13.3 and all seems to work fine there

@jonshipman
Copy link

I have a quick fix. I'll make a PR real quick. WP-GraphQL uses Type to Type to generate the connection type name. The problem is that there are a couple spots where there are duplicate types (Coupon to ExcludedProducts and Coupon to Products). My PR just adds the from name to the string.

@kidunot89
Copy link
Member

@jacobarriola @jonshipman This is has be resolved as of this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants