Missing onError handler for invocation 'building-schema': Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/
See original GitHub issueDescription
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:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top Related StackOverflow Question
@inverser-pro I solved this problem by simply changing the theme to “Twenty Twenty-One”.
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 namethen immediately launched
gatsby starteverything worked out successfully, however, after loading the add-on
when evaluating the start of development, I got the following error:
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
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…
I tried to change the wp template and my string changed to money… try to put the EN version of WP
[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.jsIt 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