cli: [Bug]: JS & CSS assets return 404 when developing locally
Please confirm that you have:
- Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
- Reproduced the issue in the latest CLI version.
In which of these areas are you experiencing a problem?
Theme
Expected behavior
After running shopify theme dev --store my-store.myshopify.com, I would expect my local test link (http://127.0.0.1:9292/) to load my CSS and JS assets.
Actual behavior
The page tries to load my CSS file via the URL http://my-store.myshopify.com/assets/app.min.css?v=154673635596667609071685626011. That URL returns a 307 redirect to https://my-store.myshopify.com/assets/app.min.css?v=154673635596667609071685966179 (mind the HTTPS), which in turn returns a 404 status.
If I update the CSS or JS assets, I see the CLI picks up the modification and syncs the updated file to the Shopify servers.
When I run shopify theme push --store my-store.myshopify.com and then request the preview link, all assets are loaded perfectly.
Verbose output
2023-06-05T12:17:26.737Z: Running command theme dev
shopify:theme:dev init version: @oclif/core@2.1.4 argv: [ '--store', 'coj-denim.myshopify.com', '--verbose' ] +0ms
2023-06-05T12:17:26.772Z: Ensuring that the user is authenticated with the Theme API with the following scopes:
[]
2023-06-05T12:17:26.773Z: Ensuring that the user is authenticated with the Admin API with the following scopes for the store coj-denim.myshopify.com:
[]
2023-06-05T12:17:26.773Z: Getting session store...
2023-06-05T12:17:26.777Z: 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"
]
For applications:
{
"adminApi": {
"scopes": [],
"storeFqdn": "coj-denim.myshopify.com"
}
}
2023-06-05T12:17:26.778Z: Sending Identity Introspection request to URL: https://accounts.shopify.com/oauth/introspection
2023-06-05T12:17:26.778Z: Sending POST request to URL https://accounts.shopify.com/oauth/introspection
With request headers:
- User-Agent: Shopify CLI; v=3.46.2
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-06-05T12:17:27.042Z: Request to https://accounts.shopify.com/oauth/introspection completed in 254 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/"56c66081557eb61ff08cdf2808f2a251"
- x-request-id: 294a5263-eebe-4b59-ac7d-cccec90b5d2d
2023-06-05T12:17:27.045Z: The identity token is valid: true
2023-06-05T12:17:27.045Z:
The validation of the token for application/identity completed with the following results:
- It's expired: false
- It's invalid in identity: false
2023-06-05T12:17:27.045Z: The current session is valid but needs refresh. Refreshing...
2023-06-05T12:17:27.046Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=refresh_token&access_token=atkn_280b33a007ceed7e36c4378673fde70dc928ce29eb2e56e9634f15b27a4ce2dd&refresh_token=atkn_9ee4f88e5fbad0afd50c868da96d195b98b1a70e7c171d01eb49c251fd91b3cb&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3
With request headers:
- User-Agent: Shopify CLI; v=3.46.2
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-06-05T12:17:27.392Z: Request to https://accounts.shopify.com/oauth/token?grant_type=refresh_token&access_token=atkn_280b33a007ceed7e36c4378673fde70dc928ce29eb2e56e9634f15b27a4ce2dd&refresh_token=atkn_9ee4f88e5fbad0afd50c868da96d195b98b1a70e7c171d01eb49c251fd91b3cb&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3 completed in 345 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/"42064e8a8b4609e62e3ca66366f05649"
- x-request-id: f5ff30cf-8dbf-4768-90cb-e46fd8f2511c
2023-06-05T12:17:27.395Z: 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=openid+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.app.cli.access&subject_token=atkn_8a2e32dc6cd625fb15f32f8c47aa573dc30bf3df1b373aed5bdd8c15580764c1
With request headers:
- User-Agent: Shopify CLI; v=3.46.2
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-06-05T12:17:27.395Z: 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=openid+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.storefront-renderer.devtools&subject_token=atkn_8a2e32dc6cd625fb15f32f8c47aa573dc30bf3df1b373aed5bdd8c15580764c1
With request headers:
- User-Agent: Shopify CLI; v=3.46.2
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-06-05T12:17:27.654Z: 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=openid+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.storefront-renderer.devtools&subject_token=atkn_8a2e32dc6cd625fb15f32f8c47aa573dc30bf3df1b373aed5bdd8c15580764c1 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/"9b593dde027e4213a67bfa136c886372"
- x-request-id: 03b3d6d5-6efa-466d-8a1c-9218931fff4c
2023-06-05T12:17:27.976Z: 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=openid+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.app.cli.access&subject_token=atkn_8a2e32dc6cd625fb15f32f8c47aa573dc30bf3df1b373aed5bdd8c15580764c1 completed in 580 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/"d31d2d1c2b1b9af234dd068472c38073"
- x-request-id: 80fd9c69-2c62-4407-9f1d-157a84b1b873
2023-06-05T12:17:27.977Z: 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=openid+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=atkn_8a2e32dc6cd625fb15f32f8c47aa573dc30bf3df1b373aed5bdd8c15580764c1&destination=https%3A%2F%2Fcoj-denim.myshopify.com%2Fadmin
With request headers:
- User-Agent: Shopify CLI; v=3.46.2
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-06-05T12:17:28.248Z: 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=openid+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=atkn_8a2e32dc6cd625fb15f32f8c47aa573dc30bf3df1b373aed5bdd8c15580764c1&destination=https%3A%2F%2Fcoj-denim.myshopify.com%2Fadmin completed in 270 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/"8a3b812d1728f5bffa3f62290e0f888b"
- x-request-id: c6f5803a-d896-456b-8046-7de87e2ce53f
2023-06-05T12:17:28.250Z: Setting session store...
2023-06-05T12:17:28.272Z: Ensuring that the user is authenticated with the Storefront API with the following scopes:
[]
2023-06-05T12:17:28.272Z: Getting session store...
2023-06-05T12:17:28.273Z: 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"
]
For applications:
{
"storefrontRendererApi": {
"scopes": []
}
}
2023-06-05T12:17:28.273Z: Sending Identity Introspection request to URL: https://accounts.shopify.com/oauth/introspection
2023-06-05T12:17:28.274Z: Sending POST request to URL https://accounts.shopify.com/oauth/introspection
With request headers:
- User-Agent: Shopify CLI; v=3.46.2
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-06-05T12:17:28.497Z: Request to https://accounts.shopify.com/oauth/introspection completed in 222 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/"b04720407ded1dfef303c157fc21aa3f"
- x-request-id: 9039ffd2-6a54-4807-bc65-fcedfdeeb355
2023-06-05T12:17:28.498Z: The identity token is valid: true
2023-06-05T12:17:28.498Z:
The validation of the token for application/identity completed with the following results:
- It's expired: false
- It's invalid in identity: false
2023-06-05T12:17:28.506Z:
Running system process:
· Command: /usr/local/opt/ruby/bin/ruby -v
· Working directory: /Applications/MAMP/htdocs/coj-denim
2023-06-05T12:17:28.522Z:
Running system process:
· Command: /usr/local/opt/ruby/bin/bundle -v
· Working directory: /Applications/MAMP/htdocs/coj-denim
2023-06-05T12:17:28.685Z: Reading the content of file at /usr/local/Cellar/shopify-cli/3.46.2/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/Gemfile...
2023-06-05T12:17:28.687Z:
Running system process:
· Command: /usr/local/opt/ruby/bin/bundle config set --local path /Users/shahways/Library/Caches/shopify-gems-nodejs
· Working directory: /usr/local/Cellar/shopify-cli/3.46.2/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby
2023-06-05T12:17:28.852Z:
Running system process:
· Command: /usr/local/opt/ruby/bin/bundle config set --local without development:test
· Working directory: /usr/local/Cellar/shopify-cli/3.46.2/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby
2023-06-05T12:17:29.017Z:
Running system process:
· Command: /usr/local/opt/ruby/bin/bundle install
· Working directory: /usr/local/Cellar/shopify-cli/3.46.2/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby
2023-06-05T12:17:29.309Z:
Running system process:
· Command: /usr/local/opt/ruby/bin/bundle exec /usr/local/opt/ruby/bin/ruby /usr/local/Cellar/shopify-cli/3.46.2/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify theme token --admin atkn_eyJhbGciOiJSUzI1NiIsImtpZCI6Ik4teW1MUDR5TWt2MlR2X3hjWkNNSlltZ2JDbjhQbm5WLWRBbUJHbTlHb3cifQ.eyJ0IjoiT21jelVOMUFYZy9hVXd2YWoybDY3NEgvL2JDOEZwck1jbTk0VUtXU3ZEVT0ifQ.KdyTHe9sbyF00vZ1fCgZMOOvyKvE-y1TBZDfEtxuU_uc0BihHi1WOpxlt4ttwjqmsQGHihfJZHi5vADLYXCX9z6yZEgy0sQJVVNgXY-Gl_Azo1mo9eiaOqy3znomB9BRO34LAKgjsPPbgAwehXfCrRGGGSlGWhfzLc_6AXoWfUPxACMyIVZnqtUC5PL7mCU1EBUChigWJ4LpdVUEDiFGGFFKgsYrRC3oWanBRU2RtIzfI3d6ZdcNkS_zaz_2OiHDIoXGUYdv6kR2VbZ0_QNgOSXWC9rshEQExECSpRGTDODBGhirZGdJ4RNTV1qJr04Jmtr0igw0dOlmFTZz-ktsqg --sfr atkn_eyJhbGciOiJSUzI1NiIsImtpZCI6Ik4teW1MUDR5TWt2MlR2X3hjWkNNSlltZ2JDbjhQbm5WLWRBbUJHbTlHb3cifQ.eyJ0IjoiWFd2Y1hGcG5FSzQzM0FBUlVsVmd1U1JGNStpajYrb2MzdEJxSE03U25ZTT0ifQ.LZhctOPW95bx_VdfT2-LBsrPk7te5g1Iu481KrGruXPbsjmzt3eYawik_dwj6l9LN2cYRe1TwE2q5dqu-EN6ATXSrgJyJmC-pdf64G7VN2Nf7pbpnmrkkVJBNnl2BgIehd6T92R7aJ4pcdiR22Valo43a_MKYwggCW8uBN4kaiRNDOAs9CHtk4ftsSPxn8a1BLh1sC4SG9JYuvnfqJYaJ0Ebx1ICu5XPv-lpvxpJdN58uYxv8OmuBJXXkH-7z-ACq2sWK0JHGjlmNDoAwDNeQ8IPqHVaiq9Y0cRCHg3XE-cGEqKuWeE75bLprVEO5yKXE2SqM0U8d9q1DrXtN1DaUw
· Working directory: /Applications/MAMP/htdocs/coj-denim
2023-06-05T12:17:29.773Z: Getting development theme...
2023-06-05T12:17:30.136Z: Request to https://coj-denim.myshopify.com/admin/api/unstable/themes/150215721257.json?fields=id completed in 361 ms
With response headers:
- content-type: application/json; charset=utf-8
- x-request-id: c03830f8-7eeb-4919-849f-80b0fcf5b949
╭─ success ────────────────────────────────────────────────────────────────────╮
│ │
│ Preview your theme │
│ • http://127.0.0.1:9292 │
│ │
│ Next steps │
│ • Customize your theme at the theme editor │
│ • Share your theme preview │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
2023-06-05T12:17:30.176Z:
Running system process:
· Command: /usr/local/opt/ruby/bin/ruby -v
· Working directory: /Applications/MAMP/htdocs/coj-denim
2023-06-05T12:17:30.191Z:
Running system process:
· Command: /usr/local/opt/ruby/bin/bundle -v
· Working directory: /Applications/MAMP/htdocs/coj-denim
2023-06-05T12:17:30.349Z: Reading the content of file at /usr/local/Cellar/shopify-cli/3.46.2/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/Gemfile...
2023-06-05T12:17:30.350Z:
Running system process:
· Command: /usr/local/opt/ruby/bin/bundle config set --local path /Users/shahways/Library/Caches/shopify-gems-nodejs
· Working directory: /usr/local/Cellar/shopify-cli/3.46.2/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby
2023-06-05T12:17:30.503Z:
Running system process:
· Command: /usr/local/opt/ruby/bin/bundle config set --local without development:test
· Working directory: /usr/local/Cellar/shopify-cli/3.46.2/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby
2023-06-05T12:17:30.656Z:
Running system process:
· Command: /usr/local/opt/ruby/bin/bundle install
· Working directory: /usr/local/Cellar/shopify-cli/3.46.2/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby
2023-06-05T12:17:30.938Z:
Running system process:
· Command: /usr/local/opt/ruby/bin/bundle exec /usr/local/opt/ruby/bin/ruby /usr/local/Cellar/shopify-cli/3.46.2/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify theme serve /Applications/MAMP/htdocs/coj-denim --live-reload hot-reload --theme 150215721257
· Working directory: /Applications/MAMP/htdocs/coj-denim
DEBUG GET https://coj-denim.myshopify.com/admin/api/unstable/themes.json with request_id: 212af237-07e1-487f-8858-a9d0332c2793
* Syncing theme #150215721257 on coj-denim.myshopify.com
DEBUG GET https://coj-denim.myshopify.com/admin/api/unstable/themes/150215721257/assets.json with request_id: 87a7a2a8-bd65-4227-bbf6-0955f3ecc519
DEBUG ignore package-lock.json
DEBUG ignore package.json
100%
[2023-06-05 14:17:32] INFO WEBrick 1.7.0
[2023-06-05 14:17:32] INFO ruby 3.2.2 (2023-03-30) [x86_64-darwin22]
[2023-06-05 14:17:32] INFO WEBrick::HTTPServer#start: pid=32758 port=9292
DEBUG Refreshing preview _secure_session_id cookie
DEBUG Proxying HEAD https://coj-denim.myshopify.com/?preview_theme_id=150215721257&_fd=0&pb=0
DEBUG `-> 302 request_id: a75b1963-e122-4a2d-812e-83b08a4a7bf5
DEBUG Proxying GET https://coj-denim.myshopify.com/?_fd=0&pb=0
DEBUG `-> 200 request_id: aa3f2622-40e9-4caf-b5dd-d1dfe0327638
DEBUG [HotReload] Connected to SSE stream
Reproduction steps
- Run
shopify theme dev --store my-store.myshopify.com - Update a JS or CSS file in the /assets folder
- Notice the Shopify CLI detecting the change and syncing the updated file to Shopify servers
- Hard refresh the local test link and inspect the CSS and JSS file return a 307 redirect to a 404 error for each asset
If necessary, I have recorded my screen and I can share if handy.
Operating System
MacOS Ventura 13.3.1 (a)
Shopify CLI version (check your project’s package.json if you’re not sure)
3.46.2
Shell
iTerm2
Node version (run node -v if you’re not sure)
v14.18.3
What language and version are you using in your application?
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 2
- Comments: 22 (7 by maintainers)
Same here.
Operating System MacOS Ventura 13.1
Shopify CLI version 3.46.2
Shell iTerm2
Node version v18.16.0
Has anyone been able to fix this?
In the meantime, I have been using the preview URL and reloading the page like it is in the early 2000s again. For me, it has not been an issue in production but has slowed development considerably.
I am happy to help in any way I can. I appreciate all the work Shopify does for the community.
If it helps, I had to run
SHOPIFY_CLI_BUNDLED_THEME_CLI=1 shopify theme dev ...to load js/css for the past few weeks. Now when I run this, I get the errorThe option --admin is not supported.Thanks again.
same issue on the Win 11 home 22H2 Node 18.16 shopify cli 3.46.2 VS Code Terminal
Same issue on Mac 13.4
The same problem persists: the asset files are not properly referenced.
Same issue here on Mac 13.4. None of the css/js is loading in local.
https://github.com/Shopify/cli/issues/2084#issuecomment-1576940169 - this might be of help, not tested yet.
Same here.
OS MacOS Venture 13.4
Shopify CLI 3.46.2
Shell Iterm2
Node v18.15.0
I have already tried uninstalling, reinstalling, and downgrading to 3.45.0 and have had the same results.