Cannot get type name from ThunkComposer
See original GitHub issuePreliminary Checks
- This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
- This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions
Description
I have enabled server-side rendering and DSG for our shop product pages. Page fetches the product review information in real-time using server-side rendering. After I enable server-side rendering, I am getting this error on build process.
Error: Cannot get type name from ThunkComposer({ _thunk: [function ], _typeName: "ContentBlock" })
This ContentBlock
is a custom schema interface that I created using the createSchemaCustomization
API.
FYI, it’s working fine on development mode.
Reproduction Link
Minimal Reproduction Repository
Steps to Reproduce
- Run
gatsby build
Expected Result
Build should be done without any problems
Actual Result
3:19:48 PM: error /opt/build/repo/.cache/query-engine/index.js:130612
3:19:48 PM: throw new Error(`Cannot get type name from ${(0,_misc__WEBPACK_IMPORTED_MODULE_2__.inspect)(type)}`);
3:19:48 PM: ^
3:19:48 PM: error Error: Cannot get type name from ThunkComposer({ _thunk: [function ], _typeName: "ContentBlock" })
3:19:48 PM: at getComposeTypeName (/opt/build/repo/.cache/query-engine/index.js:130612:13)
3:19:48 PM: at ObjectTypeComposer.hasInterface (/opt/build/repo/.cache/query-engine/index.js:126738:93)
3:19:48 PM: at ObjectTypeComposer.addInterface (/opt/build/repo/.cache/query-engine/index.js:126743:15)
3:19:48 PM: at /opt/build/repo/.cache/query-engine/index.js:206241:56
3:19:48 PM: at Array.forEach (<anonymous>)
3:19:48 PM: at mergeTypes (/opt/build/repo/.cache/query-engine/index.js:206241:26)
3:19:48 PM: at /opt/build/repo/.cache/query-engine/index.js:207100:7
3:19:48 PM: at Array.forEach (<anonymous>)
3:19:48 PM: at parseTypes (/opt/build/repo/.cache/query-engine/index.js:207086:19)
3:19:48 PM: at /opt/build/repo/.cache/query-engine/index.js:206133:23
3:19:48 PM: at Array.forEach (<anonymous>)
3:19:48 PM: at addTypes (/opt/build/repo/.cache/query-engine/index.js:206120:9)
3:19:48 PM: at updateSchemaComposer (/opt/build/repo/.cache/query-engine/index.js:205982:9)
3:19:48 PM: at buildSchema (/opt/build/repo/.cache/query-engine/index.js:205925:9)
3:19:48 PM: at build (/opt/build/repo/.cache/query-engine/index.js:24422:18)
3:19:48 PM: at GraphQLEngine._doGetRunner (/opt/build/repo/.cache/query-engine/index.js:448573:5)
Environment
System:
OS: Windows 11
Binaries
Node: v16.3.0
NPM: v7.15.1
Gatsby: v4.1.4
Config Flags
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:14 (5 by maintainers)
Top Results From Across the Web
Type with name "AuthorYaml" does not exists - gatsby-casper ...
So if you haven't defined that node, your GraphQL query is not able to run, hence the code is breaking. Pulling more the...
Read more >InterfaceTypeComposer - graphql-compose
Remove fields from type by name or array of names. ... Automatically unwrap from List, NonNull, ThunkComposer It's important! ... getTypeName(): string ...
Read more >graphql-compose - UNPKG
54, const typeName = typeDef; ... + 'Eg. `type MyType { name: String }`'); ... 144, throw new Error(`Cannot get field '${fieldName}' from...
Read more >cannot query field on type query - You.com | The AI Search ...
... objects: myBasicQuery: [BasicAnswer] type BasicAnswer { name String phone String } I was getting the error: Cannot query field \"BasicAnswer\" on type...
Read more >GraphQL error handling to the max with Typescript, codegen ...
You'll get a 5xx error in case the server is not available at all. ... Type-safety: the errors are also typed; The consumer...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@LekoArts @graysonhicks Thanks for your immediate response. I just removed
schema.graphql
file and moved the graphql code intogatsby-node.js
. Please check my last commit. But it’s the same…You can’t do this with engines as it doesn’t support bundling these files:
https://github.com/marcomiduri/gatsby-issue-reproduction/blob/50bbe785b4abcd0e92f82a4e16f0b1ee3b255295/gatsby-node.js#L17-L20
You’ll need to put the definition either in a JS file and import it or directly put it into gatsby-node.js
(So this is not a bug but a limitation)