Shopify / cli

Build apps, themes, and hydrogen storefronts for Shopify
https://shopify.dev
MIT License
437 stars 130 forks source link

[Bug]: Error while polling for changes #4897

Open bigskillet opened 4 days ago

bigskillet commented 4 days ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

Theme

Expected behavior

No errors.

Actual behavior

Polling errors while running: shopify theme dev --store store-name --theme-editor-sync --live-reload full-page. Related to --theme-editor-sync perhaps?

Image

Verbose output

Sorry, I killed the terminal before doing this.

Reproduction steps

  1. Run shopify theme dev --store store-name --theme-editor-sync --live-reload full-page
  2. Make edits to files and error will eventually appear

Operating System

macOS Sequoia 15.1.1

Shopify CLI version (check your project's package.json if you're not sure)

3.7.0

Shell

No response

Node version (run node -v if you're not sure)

No response

What language and version are you using in your application?

No response

mgmanzella commented 4 days ago

👋 can you re run this and share the verbose output? or at minimum a copy-pastable version of the request is (i cant copy it from the image) -- thanks in advance

bigskillet commented 3 days ago

Here's the text from that screenshot, extracted with Chat-GPT:

Error while polling for changes.

The Admin GraphQL API responded unsuccessfully with the HTTP status 401 and errors: “[API] Service is not valid for authentication”

Request ID: 75102210-6986-4c80-84f4-964b670714ed-1732129546

Error: Too many polling errors…

Please check the errors above and ensure you have a stable internet connection.

Starting the server with --verbose doesn't immediately give the error - it's random. I haven't been able to spot any correlations. I've been running --verbose since you asked and it keeps looping the follow code. Not sure if it's producing/revealing the error or not.

2024-11-21T16:15:32.366Z: Sending "Admin" GraphQL request:
  query getThemeFileChecksums($id: ID!, $after: String) {
  theme(id: $id) {
    files(first: 250, after: $after) {
      nodes {
        filename
        size
        checksumMd5
        __typename
      }
      userErrors {
        filename
        code
        __typename
      }
      pageInfo {
        hasNextPage
        endCursor
        __typename
      }
      __typename
    }
    __typename
  }
}

With variables:
{
  "id": "gid://shopify/OnlineStoreTheme/129630306352",
  "after": null
}

With request headers:
 - User-Agent: Shopify CLI; v=3.70.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: darwin
 - Content-Type: application/json

to https://store-name.myshopify.com/admin/api/2024-10/graphql.json
tannerkovach commented 3 days ago

Getting the same issue here as well. I'm assuming it's related to previous versions of the cli where you'd get kicked off randomly and need to re-authenticate. Happening pretty consistently though with this newer version of 'shopify theme dev'.

bigskillet commented 2 days ago

Another thing I'm noticing with --theme-editor-sync, which may be related to the polling issue, is that every time I start the server, it asks me to reconcile a file that has already been reconciled. For example, if I choose to keep the local version, stop the server, then restart, it'll ask to reconcile again. The same thing happens if I choose the remote – and I notice it doesn't update my local files. Seems like this would all be polling related, or no?