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.

Codegen/Introspection Schema/GraphQLError: Could not obtain introspection result – nuxt fails to build

See original GitHub issue

Hi there! I’ve been having issues using the shopify API. I have confirmed that the same credentials all work fine in CURL and in Paw – it seems to be an issue with @graphql-tools?

I’ve tried a few versions, from v0.1.21 - v0.1.27 without any luck. It does work great with WP GrapQL however.

ERROR  Cannot start nuxt:                                                                                                                 14:40:08
        Failed to load schema from https://xxxx.myshopify.com/api/2021-07/graphql.json:

        Could not obtain introspection result, received the following as response; 
 undefined
        GraphQLError: Could not obtain introspection result, received the following as response; 
 undefined
    at createGraphQLError (file:///xxx/node_modules/@graphql-tools/utils/esm/errors.js:6:12)
    at getSchemaFromIntrospection (file:///xxx/node_modules/@graphql-tools/wrap/esm/introspect.js:18:11)
    at file:///xxx/node_modules/@graphql-tools/wrap/esm/introspect.js:33:32
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async UrlLoader.load (file:///xxx/node_modules/@graphql-tools/url-loader/esm/index.js:587:29)
    at async file:///xxx/node_modules/@graphql-tools/load/esm/load-typedefs/load-file.js:11:39
    at async Promise.all (index 5)
    at async loadFile (file:///xxx/node_modules/@graphql-tools/load/esm/load-typedefs/load-file.js:9:9)
    at async file:///xxx/node_modules/@graphql-tools/load/esm/load-typedefs/collect-sources.js:144:25

        GraphQL Code Generator supports:
          - ES Modules and CommonJS exports (export as default or named export "schema")
          - Introspection JSON File
          - URL of GraphQL endpoint
          - Multiple files with type definitions (glob expression)
          - String in config file

        Try to use one of above options and run codegen again.

  Failed to load schema from https://xxxx.myshopify.com/api/2021-07/graphql.json:
  
  Could not obtain introspection result, received the following as response;
  undefined
  GraphQLError: Could not obtain introspection result, received the following as response;
  undefined
  at createGraphQLError (/xxx/node_modules/@graphql-tools/utils/esm/errors.js:6:12)
  at getSchemaFromIntrospection (/xxx/node_modules/@graphql-tools/wrap/esm/introspect.js:18:11)
  at /xxx/node_modules/@graphql-tools/wrap/esm/introspect.js:33:32
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at async UrlLoader.load (/xxx/node_modules/@graphql-tools/url-loader/esm/index.js:587:29)
  at async /xxx/node_modules/@graphql-tools/load/esm/load-typedefs/load-file.js:11:39
  at async Promise.all (index 5)
  at async loadFile (/xxx/node_modules/@graphql-tools/load/esm/load-typedefs/load-file.js:9:9)
  at async /xxx/node_modules/@graphql-tools/load/esm/load-typedefs/collect-sources.js:144:25
  
  GraphQL Code Generator supports:
  - ES Modules and CommonJS exports (export as default or named export "schema")
  - Introspection JSON File
  - URL of GraphQL endpoint
  - Multiple files with type definitions (glob expression)
  - String in config file
  
  Try to use one of above options and run codegen again.
  
  
  at executeCodegen (/xxx/node_modules/@graphql-codegen/cli/esm/codegen.js:322:24)
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at async generate (/xxx/node_modules/@graphql-codegen/cli/esm/generate-and-save.js:87:25)
  at async generate (/xxx/node_modules/nuxt-graphql-client/dist/module.mjs:69:10)
  at async generateGqlTypes (/xxx/node_modules/nuxt-graphql-client/dist/module.mjs:280:22)
  at async setup (/xxx/node_modules/nuxt-graphql-client/dist/module.mjs:333:5)
  at async Object.normalizedModule (/xxx/node_modules/@nuxt/kit/dist/index.mjs:637:5)
  at async installModule (/xxx/node_modules/@nuxt/kit/dist/index.mjs:456:3)
  at async initNuxt (/xxx/node_modules/nuxt/dist/index.mjs:1606:7)
  at async load (/xxx/node_modules/nuxi/dist/chunks/dev.mjs:6778:9)
  
  Error:
  Failed to load schema from https://xxxx.myshopify.com/api/2021-07/graphql.json:
  
  Could not obtain introspection result, received the following as response;
  undefined
  GraphQLError: Could not obtain introspection result, received the following as response;
  undefined
  at createGraphQLError (/xxx/node_modules/@graphql-tools/utils/esm/errors.js:6:12)
  at getSchemaFromIntrospection (/xxx/node_modules/@graphql-tools/wrap/esm/introspect.js:18:11)
  at /xxx/node_modules/@graphql-tools/wrap/esm/introspect.js:33:32
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at async UrlLoader.load (/xxx/node_modules/@graphql-tools/url-loader/esm/index.js:587:29)
  at async /xxx/node_modules/@graphql-tools/load/esm/load-typedefs/load-file.js:11:39
  at async Promise.all (index 5)
  at async loadFile (/xxx/node_modules/@graphql-tools/load/esm/load-typedefs/load-file.js:9:9)
  at async /xxx/node_modules/@graphql-tools/load/esm/load-typedefs/collect-sources.js:144:25
  
  GraphQL Code Generator supports:
  - ES Modules and CommonJS exports (export as default or named export "schema")
  - Introspection JSON File
  - URL of GraphQL endpoint
  - Multiple files with type definitions (glob expression)
  - String in config file
  
  Try to use one of above options and run codegen again.
  
  
  at loadSchema (/xxx/node_modules/@graphql-codegen/cli/esm/load.js:42:15)
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at async /xxx/node_modules/@graphql-codegen/cli/esm/codegen.js:191:69
  at async /xxx/node_modules/@graphql-codegen/cli/esm/codegen.js:190:56
  at async /xxx/node_modules/@graphql-codegen/cli/esm/codegen.js:63:21
  at async Task.run (/xxx/node_modules/listr2/dist/index.js:960:11)
  at async node_modules/p-map/index.js:57:22

My config is as follows

  // Graphql Endpoints
  runtimeConfig: {
    public: {
      "graphql-client": {
        clients: {
          default: {
            host: process.env.SHOPIFY_DOMAIN,
            token: {
              name: "X-Shopify-Storefront-Access-Token",
              value: process.env.SHOPIFY_STOREFRONT_TOKEN,
              type: null,
            },
            retainToken: true,
          },
        },
      },
    },
  },

Any ideas? Thanks!

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
blackspikecommented, Oct 17, 2022

@Diizzayy that fixed it! Thank you so much 💜💜💜

1reaction
Diizzayycommented, Oct 17, 2022

@blackspike v0.1.28 was just released with a fix for this very issue, we’ve also tested it locally against the shopify API.

token: {
  name: "X-Shopify-Storefront-Access-Token",
  value: process.env.SHOPIFY_STOREFRONT_TOKEN,
  type: null,
}

Your initial config seen above should work properly, let me know if you run into any other issues

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotansimha/graphql-code-generator - Unable to load schema
When I try to generate, it fails with 404 error, however schema exists at ... Could not obtain introspection result, ...
Read more >
Apollo-codegen introspection throws error - schema
After trying to migrate to Apollo CLI with not success due to the imposibility to introspect a self-signed certified endpoint I decided to ......
Read more >
Nuxt 3 graphql integration - DatoCMS community
Failed to load schema from https://graphql.datocms.com: Could not obtain introspection result, received: {"data":[{"id":"5413bc" ...
Read more >
Installation - Nuxt
Here, you will find information on setting up and running a Nuxt project in 4 steps.
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