wp-graphql-woocommerce icon indicating copy to clipboard operation
wp-graphql-woocommerce copied to clipboard

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

Open vstrelianyi opened this issue 2 years ago • 10 comments

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

vstrelianyi avatar Jul 04 '22 11:07 vstrelianyi

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

mrkhedri avatar Jul 10 '22 17:07 mrkhedri

@vstrelianyi Are you using GatsbyJS?

kidunot89 avatar Jul 13 '22 22:07 kidunot89

@vstrelianyi Are you using GatsbyJS?

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

vstrelianyi avatar Jul 14 '22 16:07 vstrelianyi

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

mrkhedri avatar Jul 19 '22 06:07 mrkhedri

@vstrelianyi Could provide recreate step for this issue?

kidunot89 avatar Aug 25 '22 15:08 kidunot89

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

tsamantanis avatar Aug 30 '22 09:08 tsamantanis

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.

yenbekbay avatar Dec 19 '22 08:12 yenbekbay

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

kidunot89 avatar Jan 25 '23 19:01 kidunot89

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

jasonbahl avatar Jan 27 '23 16:01 jasonbahl

Who fixed the error? I have the same one.

MihaylovMoss13 avatar Sep 19 '23 12:09 MihaylovMoss13