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.

Not working with Shopify Storefront API

See original GitHub issue

Hey guys,

I am playing around with Nuxt3 and Shopify and started testing out your library. Unfortunately it seems, that it doesn’t work with the Shopify Storefront API. Is this because the Shopify Storefront API is not able to give back the types?

I have created a repo here: https://stackblitz.com/edit/github-pkuqo9-f28qfe?file=nuxt.config.ts

Here is the error I get:

 ERROR  Cannot restart nuxt:  Something went wrong Failed to load schema for "gql-sdk.ts"                                                                     11:50:38
        Failed to load schema from https://palavin.myshopify.com/api/unstable/graphql.json:

        Could not obtain introspection result, received: undefined
        Error: Could not obtain introspection result, received: undefined
    at getSchemaFromIntrospection (file:///home/projects/github-pkuqo9-f28qfe/node_modules/@graphql-tools/wrap/index.mjs:1798:11)
    at eval (file:///home/projects/github-pkuqo9-f28qfe/node_modules/@graphql-tools/wrap/index.mjs:1813:32)
    at async UrlLoader.load (file:///home/projects/github-pkuqo9-f28qfe/node_modules/@graphql-tools/url-loader/index.mjs:792:29)
    at async eval (file:///home/projects/github-pkuqo9-f28qfe/node_modules/@graphql-tools/load/index.mjs:73:39)
    at async Promise.all (index 5)
    at async loadFile (file:///home/projects/github-pkuqo9-f28qfe/node_modules/@graphql-tools/load/index.mjs:71:9)
    at async eval (file:///home/projects/github-pkuqo9-f28qfe/node_modules/@graphql-tools/load/index.mjs:384: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://palavin.myshopify.com/api/unstable/graphql.json:
  
  Could not obtain introspection result, received: undefined
  Error: Could not obtain introspection result, received: undefined
  at getSchemaFromIntrospection (node_modules/@graphql-tools/wrap/index.mjs:1798:11)
  at eval (node_modules/@graphql-tools/wrap/index.mjs:1813:32)
  at async UrlLoader.load (node_modules/@graphql-tools/url-loader/index.mjs:792:29)
  at async eval (node_modules/@graphql-tools/load/index.mjs:73:39)
  at async Promise.all (index 5)
  at async loadFile (node_modules/@graphql-tools/load/index.mjs:71:9)
  at async eval (node_modules/@graphql-tools/load/index.mjs:384: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 (node_modules/@graphql-codegen/cli/index.mjs:1083:28)
  at async Module.generate (node_modules/@graphql-codegen/cli/index.mjs:1393:25)
  at async generate (node_modules/nuxt-graphql-client/dist/module.mjs:62:10)
  at async generateGqlTypes (node_modules/nuxt-graphql-client/dist/module.mjs:273:22)
  at async setup (node_modules/nuxt-graphql-client/dist/module.mjs:336:5)
  at async Object.normalizedModule (node_modules/@nuxt/kit/dist/index.mjs:642:5)
  at async Module.installModule (node_modules/@nuxt/kit/dist/index.mjs:457:3)
  at async initNuxt (node_modules/nuxt/dist/index.mjs:1372:7)
  at async load (node_modules/nuxi/dist/chunks/dev.mjs:6749:9)
  at async _applyPromised (node_modules/nuxi/dist/chunks/dev.mjs:6701:10)
  
  Error: Failed to load schema
  at loadSchema (node_modules/@graphql-codegen/cli/index.mjs:432:15)
  at async eval (node_modules/@graphql-codegen/cli/index.mjs:962:65)
  at async eval (node_modules/@graphql-codegen/cli/index.mjs:961:52)
  at async eval (node_modules/@graphql-codegen/cli/index.mjs:848:21)

Thanks so much for looking into that.

The Token ist definetly working.

Best regards Chris

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
chrispreislercommented, Apr 27, 2022

@Diizzayy thanks so much for looking into it so fast. Now it works like a charme. Thanks so much 😃

0reactions
chrispreislercommented, Apr 28, 2022

I really like it 😃 I just ask myself, if it is a bug or normal that it adds 20kb to the “build”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storefront API is not working with handle - Shopify Community
I found the solution to its permission issue we can say. we have to make the "Access Products" checked it's not mentioned anywhere...
Read more >
Shopify API response status and error codes
All Shopify API queries return HTTP status codes with the response headers. These codes confirm successful API transactions, explain API errors for ...
Read more >
GraphQL Storefront API - Shopify.dev
You can't use Storefront API to duplicate existing Shopify functionality — be sure to check the API terms of service before you start....
Read more >
About Shopify APIs
It allows developers to work with customer and product data, and to create custom storefronts. Sometimes you'll see this approach referred to as...
Read more >
Getting started with querying products and collections
You can request unauthenticated Storefront API access scopes during OAuth, or during authentication in the Shopify admin. The following example URL shows a ......
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