wp-graphql / wp-graphql-woocommerce

Add WooCommerce support and functionality to your WPGraphQL server
https://woographql.com
GNU General Public License v3.0
644 stars 131 forks source link

"Name \"___________________________\" must not begin with \"__\", which is reserved by GraphQL introspection." #637

Open vstrelianyi opened 2 years ago

vstrelianyi commented 2 years ago

I'm having this error when running GraphiQL IDE

"Name \"___\" must not begin with \"__\", which is reserved by GraphQL introspection."

image

WP GraphQL Version 1.8.6 WPGraphQL WooCommerce (WooGraphQL) Version 0.11.1

mrkhedri commented 2 years ago

Same Issue You can see this error when woographql is enable.

kidunot89 commented 2 years ago

@vstrelianyi Are you using GatsbyJS?

vstrelianyi commented 2 years ago

@vstrelianyi Are you using GatsbyJS?

no, I'm using next.js but this error occurs in wordpress graphql IDE

mrkhedri commented 2 years ago

I'm using GatsbyJS and this error occurs in graphql IDE

kidunot89 commented 2 years ago

@vstrelianyi Could provide recreate step for this issue?

tsamantanis commented 2 years ago

I'm also having this issue. it happened after manually installing the plugin through wp-graphql-woocommerce-2.zip and activating it on the admin dashboard. I did not change the gatsby-config.js file at all. I get this error after running gatsby develop in the createPages stage (where graphql is used for the first time)

This is my environment:

  System:
    OS: macOS 12.5.1
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Browsers:
    Chrome: 104.0.5112.101
    Firefox: 104.0
    Safari: 15.6.1
  npmPackages:
    gatsby: ^4.21.1 => 4.21.1 
    gatsby-background-image: ^1.6.0 => 1.6.0 
    gatsby-link: ^4.21.0 => 4.21.0 
    gatsby-plugin-image: ^2.21.0 => 2.21.0 
    gatsby-plugin-manifest: ^4.21.0 => 4.21.0 
    gatsby-plugin-offline: ^5.21.0 => 5.21.0 
    gatsby-plugin-react-helmet: ^5.21.0 => 5.21.0 
    gatsby-plugin-react-svg: ^3.1.0 => 3.1.0 
    gatsby-plugin-sharp: ^4.21.0 => 4.21.0 
    gatsby-react-router-scroll: ^5.21.0 => 5.21.0 
    gatsby-script: ^1.6.0 => 1.6.0 
    gatsby-source-filesystem: ^4.21.1 => 4.21.1 
    gatsby-source-wordpress: ^6.21.1 => 6.21.1 
    gatsby-transformer-sharp: ^4.21.0 => 4.21.0 
  npmGlobalPackages:
    gatsby-cli: 4.21.0
    gatsby: 4.15.2

Here is the trace:


 ERROR #11321  PLUGIN

"gatsby-node.js" threw an error while running the createPages lifecycle:

Name "_________________________________________" must not begin with "__", which is reserved by GraphQL introspection.

  221 |  */
  222 | async function getPosts({ graphql, reporter }) {
> 223 |   const graphqlResult = await graphql(/* GraphQL */ `
      |                               ^
  224 |  

File: gatsby-node.js:223:31

  Error: Name "_________________________________________" must not begin with "__", which is reserved by GraphQL introspection.

  - graphql-runner.ts:120 GraphQLRunner.validate
    [dir-name]/[gatsby]/src/query/graphql-runner.ts:120:16
 ERROR 

Missing onError handler for invocation 'extracting-queries', error was 'Error: Name "_________________________________________" must not begin with "__", which is reserved by GraphQL
introspection.'. Stacktrace was 'Error: Name "_________________________________________" must not begin with "__", which is reserved by GraphQL introspection.

    at assertValidSchema ([dir-name]/node_modules/graphql/type/validate.js:69:11)

EDIT: After further research into the issue it appears that mine comes up when using this plugin along with gatsby-source-wordpress

yenbekbay commented 1 year ago

Was able to find the root cause. This happens if you have any tax classes with non-latin characters.

https://github.com/wp-graphql/wp-graphql-woocommerce/blob/23c7f303479e0daa9516133c68ba9b523f5128fa/includes/type/enum/class-tax-class.php#L34

Apparently, the sanitization function just converts non-latin characters into underscores.

kidunot89 commented 1 year ago

@yenbekbay Good catch, I get it patch soon. 🤔

jasonbahl commented 1 year ago

@yenbekbay can you give an example of tax class(es) that caused this for you?

MihaylovMoss13 commented 1 year ago

Who fixed the error? I have the same one.