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 for "gql-sdk.ts" on deploy

See original GitHub issue

Hello dear developers,

I’ve managed to create a strapi/graphql/heroku backend that seems to be working fine to me in development mode and also on the local build. But when trying to deploy the Nuxt3/TS app to Netlify or DigitalOcean I’ve been getting this error. I guess it’s probably server-related.

Any hints would be really appreciated. πŸ˜ƒ And thanks for your work !

11:21:29 PM: ────────────────────────────────────────────────────────────────
11:21:29 PM:   1. Build command from Netlify app                             
11:21:29 PM: ────────────────────────────────────────────────────────────────
11:21:29 PM: ​
11:21:29 PM: $ yarn build
11:21:29 PM: yarn run v1.22.10
11:21:29 PM: $ nuxi build
11:21:29 PM: [log] Nuxt CLI v3.0.0-rc.1
11:21:35 PM: [error] Something went wrong Failed to load schema for "gql-sdk.ts"
11:21:35 PM:         Failed to load schema from https://catorcentena-graphql.herokuapp.com/graphql:
11:21:35 PM:         Unexpected token P in JSON at position 0
11:21:35 PM:         SyntaxError: Unexpected token P in JSON at position 0
11:21:35 PM:     at JSON.parse (<anonymous>)
11:21:35 PM:     at file:///opt/build/repo/node_modules/@graphql-tools/url-loader/index.mjs:502:37
11:21:35 PM:     at processTicksAndRejections (node:internal/process/task_queues:96:5)
11:21:35 PM:     at async UrlLoader.load (file:///opt/build/repo/node_modules/@graphql-tools/url-loader/index.mjs:776:29)
11:21:35 PM:     at async file:///opt/build/repo/node_modules/@graphql-tools/load/index.mjs:50:39
11:21:35 PM:     at async Promise.all (index 5)
11:21:35 PM:     at async loadFile (file:///opt/build/repo/node_modules/@graphql-tools/load/index.mjs:48:9)
11:21:35 PM:     at async file:///opt/build/repo/node_modules/@graphql-tools/load/index.mjs:361:25
11:21:35 PM:         GraphQL Code Generator supports:
11:21:35 PM:           - ES Modules and CommonJS exports (export as default or named export "schema")
11:21:35 PM:           - Introspection JSON File
11:21:35 PM:           - URL of GraphQL endpoint
11:21:35 PM:           - Multiple files with type definitions (glob expression)
11:21:35 PM:           - String in config file
11:21:35 PM:         Try to use one of above options and run codegen again.
11:21:35 PM:   Failed to load schema from https://catorcentena-graphql.herokuapp.com/graphql:
11:21:35 PM:   Unexpected token P in JSON at position 0
11:21:35 PM:   SyntaxError: Unexpected token P in JSON at position 0
11:21:35 PM:   at JSON.parse (<anonymous>)
11:21:35 PM:   at node_modules/@graphql-tools/url-loader/index.mjs:502:37
11:21:35 PM:   at processTicksAndRejections (node:internal/process/task_queues:96:5)
11:21:35 PM:   at async UrlLoader.load (node_modules/@graphql-tools/url-loader/index.mjs:776:29)
11:21:35 PM:   at async node_modules/@graphql-tools/load/index.mjs:50:39
11:21:35 PM:   at async Promise.all (index 5)
11:21:35 PM:   at async loadFile (node_modules/@graphql-tools/load/index.mjs:48:9)
11:21:35 PM:   at async node_modules/@graphql-tools/load/index.mjs:361:25
11:21:35 PM:   GraphQL Code Generator supports:
11:21:35 PM:   - ES Modules and CommonJS exports (export as default or named export "schema")
11:21:35 PM:   - Introspection JSON File
11:21:35 PM:   - URL of GraphQL endpoint
11:21:35 PM:   - Multiple files with type definitions (glob expression)
11:21:35 PM:   - String in config file
11:21:35 PM:   Try to use one of above options and run codegen again.
11:21:35 PM:   at executeCodegen (node_modules/@graphql-codegen/cli/index.mjs:1051:28)
11:21:35 PM:   at processTicksAndRejections (node:internal/process/task_queues:96:5)
11:21:35 PM:   at async generate (node_modules/@graphql-codegen/cli/index.mjs:1361:25)
11:21:35 PM:   at async generate (node_modules/nuxt-graphql-client/dist/module.mjs:57:10)
11:21:35 PM:   at async generateGqlTypes (node_modules/nuxt-graphql-client/dist/module.mjs:277:22)
11:21:35 PM:   at async setup (node_modules/nuxt-graphql-client/dist/module.mjs:340:5)
11:21:35 PM:   at async Object.normalizedModule (node_modules/@nuxt/kit/dist/index.mjs:577:5)
11:21:35 PM:   at async installModule (node_modules/@nuxt/kit/dist/index.mjs:392:3)
11:21:35 PM:   at async initNuxt (node_modules/nuxt/dist/index.mjs:1362:7)
11:21:35 PM:   at async loadNuxt (node_modules/nuxt/dist/index.mjs:1384:5)
11:21:35 PM:   Error: Failed to load schema
11:21:35 PM:   at loadSchema (node_modules/@graphql-codegen/cli/index.mjs:400:15)
11:21:35 PM:   at processTicksAndRejections (node:internal/process/task_queues:96:5)
11:21:35 PM:   at async node_modules/@graphql-codegen/cli/index.mjs:930:65
11:21:35 PM:   at async node_modules/@graphql-codegen/cli/index.mjs:929:52
11:21:35 PM:   at async node_modules/@graphql-codegen/cli/index.mjs:816:21
11:21:35 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
11:21:35 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
fskarmetacommented, May 8, 2022

@Diizzayy yes… that solved that issue! I should have tried that out before. Thanks so much for your time! Really appreciate it

0reactions
Diizzayycommented, May 8, 2022

@fskarmeta No problem at all, I’m happy to help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to load schema, no error output Β· Issue #8138 - GitHub
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...
Read more >
Failed to load schema from http://localhost:8000/graphql ...
My localhost is serving the GraphiQL interface just fine, showing the correct schema and all, but the code-generator script shows the same asΒ ......
Read more >
Nuxt 3 graphql integration - DatoCMS community
Cannot start nuxt: Failed to load schema for β€œgql-sdk.ts” 09:49:51. Failed to load schema from https://graphql.datocms.com:
Read more >
GraphQL Code Libraries, Tools and Services
GitHubbabyfish-ct/graphql-ts-client ... A set of utils for faster development of GraphQL tools (Schema and documents loading, Schema merging and more).
Read more >
GraphQL error handling to the max with Typescript, codegen ...
We can take advantage of it and design our schema to specify all ... Let's instead implement error handling using Union types with...
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