Failed to load schema, no error output
See original GitHub issueDescribe the bug
I had a schema from AppSync which includes an AWSJSON scalar type. If I don’t define that type, graphql-codegen fails with absolutely no indication of why, just that it “Failed to load schema”
Your Example Website or App
https://codesandbox.io/s/inspiring-panna-ixxqrr?file=/schema.graphql
Steps to Reproduce the Bug or Issue
- Open the codesandbox link.
- Run
yarn generate
- Notice the output:
Expected behavior
Some sort of error indicating an unresolved type of AWSJSON
. If I change that prop in the schema to be a String
, everything works just fine.
Screenshots or Videos
No response
Platform
- OS: macOS
- NodeJS: 16.16.0
graphql
version: 16.5.0@graphql-codegen/*
version(s): [e.g. 2.6.2] “@graphql-codegen/cli”: “^2.9.1”, “@graphql-codegen/typed-document-node”: “^2.3.2”, “@graphql-codegen/typescript-operations”: “^2.5.2”,
Codegen Config File
overwrite: true schema:
- src/generated/foo.graphql
documents: null
generates:
src/generated/graphql.ts:
plugins:
- typescript
- typescript-operations
- typed-document-node config: preResolveTypes: true
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:5
Top Results From Across the Web
Failed to load schema from http://localhost:8000/graphql ...
This question deals with a similar problem; however, I am sure that my server is running and the error message in that question...
Read more >WebIDE does not load the syntax validation schema on GitLab ...
Summary. On GitLab.com using the WebIDE to edit .yml files the IDE highlights a warning message under the first character on the file....
Read more >Restarting a failed copy schema operation - IBM
The db2move utility reports errors and messages to the user using message and error files. Copy schema operations use the COPYSCHEMA_ timestamp ....
Read more >ERROR: Error while loading schema - DataStax Support
What does this ERROR message mean? ... An error while loading schema means an exception occurred while attempting to load the schema saved...
Read more >Troubleshooting errors in AWS Glue
Error : Could not find S3 endpoint or NAT gateway for subnetId in VPC ... if it points to a folder that no...
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
agreed this error message is not really helpful. We should be showing the validation error that is thrown instead of saying failed to load. The challenge is that
load
schema function throws and we just catch and show this error https://github.com/dotansimha/graphql-code-generator/blob/ab66ba10456a96cce0bd83ba172aae8f963bf2af/packages/graphql-codegen-cli/src/load.ts#L54-L72 rather we want to be able to differentiateValidation
,Parsing
andLoading
which is work on@graphql-tools/
to have distinct errors for different or have more standard codesRight, I know why it failed and how to fix it. But it’s very undesirable to not get any error message as to why the schema failed to load (i.e. unknown type “AWSJSON”). This is just an MRE showing my issue, this was initially part of a much larger, complex schema and it took a decent amount of time to troubleshoot with the only output being “Failed to load schema”.