Why does GraphQl show a 401 error after one hour of idle on my app?

RolandsK
Shopify Partner
4 0 2

Hi! Is someone experiencing an issue like this? Whenever I start my shopify app, within about one hour I get:

 

"Error: GraphQL Error (Code: 401): {"response":{"error":"","status":401,"headers":{}},"request":{"query":"\n query FindApp($apiKey: String!) {\n app(apiKey: $apiKey) {\n developmentStorePreviewEnabled\n }\n }\n","variables": ...".

I narrowed it down to being checkout extension. Tried to use different computer and partner account and still got the same issue.

Steps:

  1. npm init @Shopify/app@latest //chose remix
  2. cd your-app
  3. npm run shopify app generate extension
  4. npm run dev
  5. Went into the app and checked that I have the checkout extension
  6. Wait about 1-2 hours and the previously mentioned error appears.

Happy to give more details if you think of anything. Here are my versions:

"@shopify/cli": "3.48.6"
"@shopify/app": "3.48.6",
node -v: v18.17.1
Replies 3 (3)

appdev2023
Shopify Partner
20 2 3

+1 same issue for me. i've had it in as little as 10 minutes or so. mine isn't a checkout extension; it seems just related to running the local dev server

 

stack trace isn't very helpful:

at makeRequest (file:///.../node_modules/graphql-request/build/esm/index.js:284:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async debugLogResponseInfo (file:///.../node_modules/@shopify/cli-kit/dist/private/node/api.js:13:20)
at async graphqlRequest (file:///.../node_modules/@shopify/cli-kit/dist/public/node/api/graphql.js:20:22)

leonpl
Shopify Partner
8 0 0

I have the same error after idling for a short while.

Was working ok before I upgrade shopify cli. 

Error: GraphQL Error (Code: 401): {"response":{"error":"","status":401,"headers":{}},"request":{"query":"\n query FindApp($apiKey: String!) {\n app(apiKey: $apiKey) {\n developmentStorePreviewEnabled\n }\n }\n","variables":{"apiKey":"XX"}}}

 

not sure if modify the esm/index.js to catch error rather than 'throw' will help..

 

RolandsK
Shopify Partner
4 0 2

I created an issue on github a few days ago, but still haven't gotten the response back. Hopefully it's the right repository. As for the issue - I'm still getting it. 
https://github.com/Shopify/shopify-app-template-remix/issues/330