Shopify / cli

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

[Bug]: shopify theme dev - cors error Shopify Assets #3035

Open ceri-waterscreative opened 8 months ago

ceri-waterscreative commented 8 months ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

Theme

Expected behavior

No Cors Error?

Actual behavior

Cors Error.

image (1)

Screenshot 2023-10-31 094605

Verbose output

CeriM@DESKTOP-76ILN69 MINGW64 /c/LocalWeb/Shopify/C W Sellors/Main Theme/0-main (production)   
$ shopify theme dev --store=cwsellors-test.myshopify.com --verbose
2023-10-31T09:49:26.284Z: Running command theme dev
  shopify:theme:dev init version: @oclif/core@2.11.7 argv: [ '--store=cwsellors-test.myshopify.com', '--verbose' ] +0ms
2023-10-31T09:49:26.309Z: Ensuring that the user is authenticated with the Theme API with the following scopes:
[]

2023-10-31T09:49:26.311Z: Ensuring that the user is authenticated with the Admin API with the following scopes for the store cwsellors-test.myshopify.com:
[]

2023-10-31T09:49:26.312Z: Getting session store...
2023-10-31T09:49:26.316Z: Validating existing session against the scopes:
[
  "openid",
  "https://api.shopify.com/auth/shop.admin.graphql",
  "https://api.shopify.com/auth/shop.admin.themes",
  "https://api.shopify.com/auth/partners.collaborator-relationships.readonly",
  "https://api.shopify.com/auth/shop.storefront-renderer.devtools",
  "https://api.shopify.com/auth/partners.app.cli.access",
  "https://api.shopify.com/auth/destinations.readonly"
]
For applications:
{
  "adminApi": {
    "scopes": [],
    "storeFqdn": "cwsellors-test.myshopify.com"
  }
}

2023-10-31T09:49:26.319Z: Sending Identity Introspection request to URL: https://accounts.shopify.com/oauth/introspection
2023-10-31T09:49:26.320Z: Sending POST request to URL https://accounts.shopify.com/oauth/introspection
With request headers:
 - User-Agent: Shopify CLI; v=3.50.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2023-10-31T09:49:26.552Z: Request to https://accounts.shopify.com/oauth/introspection completed in 219 ms
With response headers:
 - cache-control: no-cache, no-store, private, must-revalidate, max-age=0
 - content-type: application/json; charset=utf-8
 - etag: W/"5e48e7b9d08aa3d69b72ae1d01ffc6ff"
 - x-request-id: 6c95b54e-0b21-4ae1-a3be-6db7e0846cfc

2023-10-31T09:49:26.558Z: The identity token is valid: true
2023-10-31T09:49:26.559Z:
The validation of the token for application/identity completed with the following results:     
- It's expired: false
- It's invalid in identity: false

2023-10-31T09:49:26.559Z: The current session is valid but needs refresh. Refreshing...        
2023-10-31T09:49:26.561Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=refresh_token&access_token=atkn_CjQIiZuDqgYQqdODqgZSJggBEhBg9qEZ4alHt4WTTKK_cmpHGhBOP1r-JgFLrrYkjhlPzhB_EkAbGcOqgj8GU88vlqmDRXkxYxzq43olcEtt8OltOTHv7F4iCibLIcKkZfUP8LX0HLG1GC9AXqEEyCLIdUU_T6wP&refresh_token=atkn_CiEIiZuDqgYQibWhqwaiARIKEE4_Wv4mAUuutiSOGU_OEH8SQHGHLqwkhMmfs40pXJ8FTR5aeI3BKWSxljm1YMuVAX8QyDKJeKl1ho6Tu6EF7AbEubybaF7jkFb0WyvXcjidVQI&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3
With request headers:
 - User-Agent: Shopify CLI; v=3.50.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2023-10-31T09:49:26.822Z: Request to https://accounts.shopify.com/oauth/token?grant_type=refresh_token&access_token=atkn_CjQIiZuDqgYQqdODqgZSJggBEhBg9qEZ4alHt4WTTKK_cmpHGhBOP1r-JgFLrrYkjhlPzhB_EkAbGcOqgj8GU88vlqmDRXkxYxzq43olcEtt8OltOTHv7F4iCibLIcKkZfUP8LX0HLG1GC9AXqEEyCLIdUU_T6wP&refresh_token=atkn_CiEIiZuDqgYQibWhqwaiARIKEE4_Wv4mAUuutiSOGU_OEH8SQHGHLqwkhMmfs40pXJ8FTR5aeI3BKWSxljm1YMuVAX8QyDKJeKl1ho6Tu6EF7AbEubybaF7jkFb0WyvXcjidVQI&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3 completed in 257 ms
With response headers:
 - cache-control: no-cache, no-store, private, must-revalidate, max-age=0
 - content-type: application/json; charset=utf-8
 - etag: W/"2d6f4fc938084532a38bef9c592c796e"
 - x-request-id: 7534ab54-77c0-4ebf-b0bb-534b6519947d

2023-10-31T09:49:26.827Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=271e16d403dfa18082ffb3d197bd2b5f4479c3fc32736d69296829cbb28d41a6&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.app.cli.access&subject_token=****
With request headers:
 - User-Agent: Shopify CLI; v=3.50.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2023-10-31T09:49:26.829Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=ee139b3d-5861-4d45-b387-1bc3ada7811c&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.storefront-renderer.devtools&subject_token=****
With request headers:
 - User-Agent: Shopify CLI; v=3.50.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2023-10-31T09:49:26.830Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=32ff8ee5-82b8-4d93-9f8a-c6997cefb7dc&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fdestinations.readonly&subject_token=****
With request headers:
 - User-Agent: Shopify CLI; v=3.50.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2023-10-31T09:49:26.833Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=7ee65a63608843c577db8b23c4d7316ea0a01bd2f7594f8a9c06ea668c1b775c&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.admin.graphql+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.admin.themes+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.collaborator-relationships.readonly&subject_token=****&destination=https%3A%2F%2Fcwsellors-test.myshopify.com%2Fadmin
With request headers:
 - User-Agent: Shopify CLI; v=3.50.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2023-10-31T09:49:27.055Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=271e16d403dfa18082ffb3d197bd2b5f4479c3fc32736d69296829cbb28d41a6&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.app.cli.access&subject_token=**** completed in 219 ms
With response headers:
 - cache-control: no-cache, no-store, private, must-revalidate, max-age=0
 - content-type: application/json; charset=utf-8
 - etag: W/"1b0fd86a7d5d5a73b8ac2d7053e33185"
 - x-request-id: d1f38c73-5562-4ad9-a001-4dce2ab52b15

2023-10-31T09:49:27.061Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=7ee65a63608843c577db8b23c4d7316ea0a01bd2f7594f8a9c06ea668c1b775c&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.admin.graphql+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.admin.themes+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.collaborator-relationships.readonly&subject_token=****&destination=https%3A%2F%2Fcwsellors-test.myshopify.com%2Fadmin completed in 220 ms
With response headers:
 - cache-control: no-cache, no-store, private, must-revalidate, max-age=0
 - content-type: application/json; charset=utf-8
 - etag: W/"9c6401890985f84dcd9d95dfa55549b8"
 - x-request-id: 8e23da4f-98e9-4a78-bf1e-1957749513e0

2023-10-31T09:49:27.065Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=32ff8ee5-82b8-4d93-9f8a-c6997cefb7dc&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fdestinations.readonly&subject_token=**** completed in 226 ms
With response headers:
 - cache-control: no-cache, no-store, private, must-revalidate, max-age=0
 - content-type: application/json; charset=utf-8
 - etag: W/"252916bc9a15fcbb1a21b830d8a6ef68"
 - x-request-id: 8715fff4-08c7-4e4a-a78b-c8138473b909

2023-10-31T09:49:27.070Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=ee139b3d-5861-4d45-b387-1bc3ada7811c&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.storefront-renderer.devtools&subject_token=**** completed in 232 ms
With response headers:
 - cache-control: no-cache, no-store, private, must-revalidate, max-age=0
 - content-type: application/json; charset=utf-8
 - etag: W/"7bfaac948d32e6a0b6f302fbbdc90b3d"
 - x-request-id: 2f18acee-cb7c-47a1-8e54-4b9dc38f51aa

2023-10-31T09:49:27.074Z: Setting session store...
2023-10-31T09:49:27.082Z: Ensuring that the user is authenticated with the Storefront API with the following scopes:
[]

2023-10-31T09:49:27.083Z: Getting session store...
2023-10-31T09:49:27.090Z: Validating existing session against the scopes:
[
  "openid",
  "https://api.shopify.com/auth/shop.admin.graphql",
  "https://api.shopify.com/auth/shop.admin.themes",
  "https://api.shopify.com/auth/partners.collaborator-relationships.readonly",
  "https://api.shopify.com/auth/shop.storefront-renderer.devtools",
  "https://api.shopify.com/auth/partners.app.cli.access",
  "https://api.shopify.com/auth/destinations.readonly"
]
For applications:
{
  "storefrontRendererApi": {
    "scopes": []
  }
}

2023-10-31T09:49:27.093Z: Sending Identity Introspection request to URL: https://accounts.shopify.com/oauth/introspection
2023-10-31T09:49:27.094Z: Sending POST request to URL https://accounts.shopify.com/oauth/introspection
With request headers:
 - User-Agent: Shopify CLI; v=3.50.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2023-10-31T09:49:27.295Z: Request to https://accounts.shopify.com/oauth/introspection completed in 198 ms
With response headers:
 - cache-control: no-cache, no-store, private, must-revalidate, max-age=0
 - content-type: application/json; charset=utf-8
 - etag: W/"73fba92704e63475dfa7b50a9491a12a"
 - x-request-id: ac189b4c-9613-4a80-8560-5033e31916fb

2023-10-31T09:49:27.298Z: The identity token is valid: true
2023-10-31T09:49:27.298Z:
The validation of the token for application/identity completed with the following results:     
- It's expired: false
- It's invalid in identity: false

2023-10-31T09:49:27.343Z: 
Running system process:
  · Command: ruby -v
  · Working directory: C:/LocalWeb/Shopify/C W Sellors/Main Theme/0-main

2023-10-31T09:49:27.402Z: 
Running system process:
  · Command: bundle -v
  · Working directory: C:/LocalWeb/Shopify/C W Sellors/Main Theme/0-main

2023-10-31T09:49:27.912Z: Reading the content of file at C:/Users/CeriM/AppData/Roaming/npm/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/Gemfile...
2023-10-31T09:49:27.945Z: 
Running system process:
  · Command: bundle config set --local path C:\Users\CeriM\AppData\Local\shopify-gems-nodejs\Cache
  · Working directory: C:/Users/CeriM/AppData/Roaming/npm/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby

2023-10-31T09:49:28.504Z: 
Running system process:
  · Command: bundle config set --local without development:test
  · Working directory: C:/Users/CeriM/AppData/Roaming/npm/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby

2023-10-31T09:49:29.048Z: 
Running system process:
  · Command: bundle install
  · Working directory: C:/Users/CeriM/AppData/Roaming/npm/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby

2023-10-31T09:49:30.019Z: 
Running system process:
  · Command: bundle exec ruby C:/Users/CeriM/AppData/Roaming/npm/node_modules/@shopify/theme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7pbqZxsN
  · Working directory: C:/LocalWeb/Shopify/C W Sellors/Main Theme/0-main

2023-10-31T09:49:31.780Z: Getting development theme...
2023-10-31T09:49:32.105Z: Request to https://cwsellors-test.myshopify.com/admin/api/unstable/themes/162783723831.json?fields=id%2Cprocessing completed in 322 ms
With response headers:
 - content-type: application/json; charset=utf-8
 - x-request-id: dc8bb1a2-628d-4d9d-bcab-1c29af3be654

╭─ success ────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  Preview your theme                                                          │
│    • http://127.0.0.1:9292 [1]                                               │
│                                                                              │
│  Next steps                                                                  │
│    • Customize your theme at the theme editor [2]                            │
│    • Share your theme preview [3]                                            │
│      (https://cwsellors-test.myshopify.com/?preview_theme_id=162783723831)   │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯
[1] http://127.0.0.1:9292
[2] https://cwsellors-test.myshopify.com/admin/themes/162783723831/editor
[3] https://cwsellors-test.myshopify.com/?preview_theme_id=162783723831

2023-10-31T09:49:32.189Z: 
Running system process:
  · Command: ruby -v
  · Working directory: C:/LocalWeb/Shopify/C W Sellors/Main Theme/0-main

2023-10-31T09:49:32.241Z: 
Running system process:
  · Command: bundle -v
  · Working directory: C:/LocalWeb/Shopify/C W Sellors/Main Theme/0-main

Reproduction steps

  1. Spin up the Shopify CLI "shopify theme dev"
  2. Open up Firefox
  3. Look at console

Operating System

Windows 11

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

3.50.0

Shell

Git Bash

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

v18.12.1

What language and version are you using in your application?

N/A

bigskillet commented 8 months ago

I'm having the same issue. When I run shopify theme dev, the preview URL (127.0.0.1:9292) will not resolve on Chrome:

Screenshot 2023-11-01 at 9 45 03 AM
james0r commented 8 months ago

I think this is related. This asset just hangs as pending

image

I don't see any CORS errors but it's the only asset that has Sec-Fetch-Mode set to cors. It prevents reloading of the page unless I block the Request URL in the devtools.

It intermittently works but I can't figure out why.

lukecharle commented 7 months ago

Is there any updates on this? I'm getting this on fonts and images

lukecharle commented 6 months ago

Bumping this again, still having this issue.

github-actions[bot] commented 5 months ago

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

lukecharle commented 5 months ago

Bumping again

ceri-waterscreative commented 5 months ago

Also bumping

kevin-golo commented 4 months ago

+1

ryantownsend commented 3 months ago

+1

ceri-waterscreative commented 3 months ago

Bump Bump

Arecsu commented 2 months ago

+1 Happening on Firefox, doesn't happen in Chromium-based browsers