question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to load schema, no error output

See original GitHub issue

Describe 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

  1. Open the codesandbox link.
  2. Run yarn generate
  3. Notice the output: image

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

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:open
  • Created a year ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

3reactions
saihajcommented, Jul 27, 2022

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 differentiate Validation, Parsing and Loading which is work on @graphql-tools/ to have distinct errors for different or have more standard codes

3reactions
taschmidtcommented, Jul 26, 2022

Right, 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”.

Read more comments on GitHub >

github_iconTop 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 >

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