Missing onError handler for invocation 'building-schema': Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/

See original GitHub issue

Description

Dynamic page queries are resulting in current version to new “typeBuilder”-type in gatsby/dist/schema/schema.js, and later on fail through assertValidName() in checkIsAllowedTypeName() because of its name. In the previous version, this type did not exist and therefore did not fail. I guess this type its not needed or at least the created type name is wrong.

Steps to reproduce

File with name “{StrapiBlogPost.slug}.js” is existing with this query:

export const query = graphql`
  query BlogPostQuery($slug: String!) {
    strapiBlogPost(slug: { eq: $slug }) {
      some_fields_here
    }
  }`

run with yarn develop or build

Expected result

the build should work

Actual result

success source and transform nodes - 7.159s

 ERROR 

Missing onError handler for invocation 'building-schema', error was 'Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "StrapiBlog-post" does not.'. Stacktrace was 'GraphQLError: Names
must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "StrapiBlog-post" does not.
    at isValidNameError (./frontend/node_modules/graphql/utilities/assertValidName.js:42:12)
    at assertValidName (./frontend/node_modules/graphql/utilities/assertValidName.js:21:15)
    at checkIsAllowedTypeName (./frontend/node_modules/gatsby/src/schema/schema.js:608:3)
    at forEach (./frontend/node_modules/gatsby/src/schema/schema.js:313:9)
    at Array.forEach (<anonymous>)
    at addTypes (./frontend/node_modules/gatsby/src/schema/schema.js:275:9)
    at updateSchemaComposer (./frontend/node_modules/gatsby/src/schema/schema.js:162:9)
    at buildSchema (./frontend/node_modules/gatsby/src/schema/schema.js:64:9)
    at build (./frontend/node_modules/gatsby/src/schema/index.js:105:24)
    at buildSchema (./frontend/node_modules/gatsby/src/services/build-schema.ts:19:3)'

the error raises because of a new type which is checked in this line that its name is valid. a console.log in the previous version right before this line did show that the type for the query was not existing.

Environment

System: OS: Linux 5.4 Linux Mint 20 (Ulyana) CPU: (12) x64 AMD Ryzen 5 2600X Six-Core Processor Shell: 5.0.17 - /bin/bash Binaries: Node: 14.15.4 - ~/.nvm/versions/node/v14.15.4/bin/node Yarn: 1.22.10 - ~/.nvm/versions/node/v14.15.4/bin/yarn npm: 6.14.10 - ~/.nvm/versions/node/v14.15.4/bin/npm Browsers: Chrome: 90.0.4430.93 Firefox: 88.0 npmPackages: gatsby: ^3.0.4 => 3.4.0 gatsby-background-image: ^1.4.1 => 1.5.2 gatsby-image: ^3.0.0 => 3.4.0 gatsby-link: ^3.0.1 => 3.4.0 gatsby-plugin-gdpr-cookies: ^1.0.14 => 1.0.14 gatsby-plugin-image: ^1.1.2 => 1.4.0 gatsby-plugin-manifest: ^3.0.0 => 3.4.0 gatsby-plugin-offline: ^4.0.0 => 4.4.0 gatsby-plugin-react-helmet: ^4.0.0 => 4.4.0 gatsby-plugin-sentry: ^1.0.1 => 1.0.1 gatsby-plugin-sharp: ^3.0.0 => 3.4.0 gatsby-source-filesystem: ^3.0.0 => 3.4.0 gatsby-source-strapi: ^1.0.0-alpha.0 => 1.0.0-alpha.1 gatsby-source-strapi-plugin-navigation: ^1.2.7 => 1.2.7 gatsby-transformer-sharp: ^3.0.0 => 3.4.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Morlin1129commented, Jul 4, 2022

@inverser-pro I solved this problem by simply changing the theme to “Twenty Twenty-One”.

1reaction
inverser-procommented, Apr 5, 2022

Hello, friends. I have the same problem as the author. How do I do it: installed WordPress (Ru-version) on my hosting, installed gatsby-cli on my PC

then run npx gatsby new name

then immediately launched gatsby start

everything worked out successfully, however, after loading the add-on

allow: 'gatsby-source-wordpress',
      options: {
        URL: 'https://site.some/graphql',
      }

when evaluating the start of development, I got the following error:

Missing onError handler for invocation 'building-schema', error was 'Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "WpTemplate_Единичная запись (без разделителей)" does not.'. Stacktrace was
'GraphQLError: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "WpTemplate_Единичная запись (без разделителей)" does not.
    at isValidNameError (/path/_TRUD/_gatsby/projects/project/node_modules/graphql/utilities/assertValidName.js:42:12)
    at assertValidName  (/path/_TRUD/_gatsby/projects/project/node_modules/graphql/utilities/assertValidName.js:21:15)
    at checkIsAllowedTypeName (/path/_TRUD/_gatsby/projects/project/node_modules/gatsby/src/schema/schema.js:619:3)
    at forEach (/path/_TRUD/_gatsby/projects/project/node_modules/gatsby/src/schema/schema.js:297:9)
    at Array.forEach (<anonymous>)
    at addTypes (/path/_TRUD/_gatsby/projects/project/node_modules/gatsby/src/schema/schema.js:258:9)
    at updateSchemaComposer (/path/_TRUD/_gatsbys/project/project/node_modules/gatsby/src/schema/schema.js:130:9)
    at buildSchema (/path/_TRUD/_gatsby/projects/project/node_modules/gatsby/src/schema/schema.js:71:9)
    at build (/path/_TRUD/_gatsby/projects/project/node_modules/gatsby/src/schema/index.js:112:18)
    at buildSchema (/path/_TRUD/_gatsby/projects/project/node_modules/gatsby/src/services/build-schema.ts:19:3)'

⠴ building schema

I suppose to find a similar situation in Google, however, there was nothing but this page.

Reminder that I installed wp from here https://ru.wordpress.org/download/

and, of course, there is a Russian involution, which I needed.

However, for some reason (as they say, the name of the template is to blame for this), somewhere the standard name is exactly

WpTemplate_Единичная запись (без разделителей)

so the script does not skip such a name and throws an error

at isValidNameError (/path/_TRUD/_gatsby/projects/project/node_modules/graphql/utilities/assertValidName.js:42:12)
at assertValidName (/path/_TRUD/_gatsby/projects/project/node_modules/graphql/utilities/assertValidName.js:21:15)

I regularly changed the 15 line review, outside of the check, which missed the name, which was restored to default in WP and it worked. var NAME_RX = /^[_a-zA-Zа-яА-Я][_a-zA-Zа-яА-Я0-9\s()]*$/;

Should you check the name in some other way so that people in other languages ​​​​(other than EN) do not have errors in development?

UPD: I have new error…

ERROR #98123  WEBPACK

Generating development JavaScript bundle failed

Error while loading rule 'graphql/template-strings': Syntax Error: Cannot parse the unexpected character "\u0428".
Occurred while linting /path/_TRUD/_gatsby/projects/project/src/pages/page-2.js

failed Building development bundle - 30.279s
ERROR in Error while loading rule 'graphql/template-strings': Syntax Error: Cannot parse the unexpected character "\u0428".
Occurred while linting /path/_TRUD/_gatsby/projects/project/src/pages/page-2.js

develop compiled with 1 error
success Writing page-data.json files to public directory - 0.468s - 3/5 10.68/s

I tried to change the wp template and my string changed to money… try to put the EN version of WP

Missing onError handler for invocation 'building-schema', error was 'Names must match /^[_a-zA-Zа-яА-Я][_a-zA-Zа-яА-Я0-9s()]*$/ but "WpTemplate_Шаблон обложки" does not.'.
Stacktrace was 'GraphQLError: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "WpTemplate_Шаблон обложки" does not.

[SOLVED]

The file must be returned to its previous state, since it does not in vain allow new errors to appear … Due to other characters, new errors appear …

/node_modules/graphql/utilities/assertValidName.js

It helped me

I installed this template and everything worked in the RU version Twenty Twenty-Two version: 1.1

---- Remember to clear the cache gatsby clean

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix Invariant Violation errors when running Gatsby build ...
Missing onError handler for invocation 'building-schema', error was Invariant Violation: Encountered an error trying to infer a GraphQL type ...
Read more >
Issues Updating to Gatsby 4.9.2 : r/gatsbyjs - Reddit
as well as - "Missing onError handler for invocation 'building-schema', error was 'Error: Cannot create as TypeComposer the following ...
Read more >
How do I resolve issues with missing or incorrect schema ...
I have run into various cases where errors are occurring related to the DatabaseSchemaVersion property in the LSW_SYSTEM_SCHEMA table for the BPM and...
Read more >
gatsby develop で Missing onError handler for invocation ...
Copied! Missing onError handler for invocation 'building-schema', error was 'Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "WpTemplate_空白" ...
Read more >
Creating a BPF in Power automate and i get this error
"The table could not be updated: The schema name customertype for type OptionSet is invalid or missing.Custom attribute, entity, entitykey, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found