cli: [Bug]: shopify theme dev local server is redirecting to the actual theme URL (CLI 3.44.1)
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
Running shopify theme dev
produces a local development theme (http://127.0.0.1:9292) which allows for real time testing with that stores data without having to push and pull from the theme.
Actual behavior
After running shopify theme dev
, when opening the local URL
http://127.0.0.1:9292
in the Google Chrome (Version 111.0.5563.64), I am redirected to the theme’s actual store URL
https://my_theme.myshopify.com/password?_fd=0
I have done some extensive digging trying to find a similar case and the only other open ticket I found was here on a 2.x CLI, which seems to still be unresolved: https://github.com/Shopify/shopify-cli/issues/2315
I can get around the issue by pushing to the theme and then testing there but like the other post mentioned this defeats the entire purpose of the development CLI.
I have tired to clear browser data, use chrome incognito, open url via command line, changing the port the command is using… nothing. I can also include the chrome developer tools network response if that is needed.
I originally had a theme that was connected with GitHub and was concerned that it may be causing the issue. I ended up creating a new development store and pulled the default Dawn theme locally following this documentation: https://shopify.dev/docs/themes/tools/cli. Still no dice. Next, I thought that maybe it was because I was working with the published theme. I copied the dawn theme I had just made and pulled the unpublished theme locally and tried again… same issue.
Verbose output
test-shopify shopify theme dev --verbose
2023-03-22T15:40:23.168Z: Running command theme dev
shopify:theme:dev init version: @oclif/core@2.1.4 argv: [ '--verbose' ] +0ms
2023-03-22T15:40:23.195Z: Ensuring that the user is authenticated with the Theme API with the following scopes:
[]
2023-03-22T15:40:23.195Z: Ensuring that the user is authenticated with the Admin API with the following scopes for the store CCK-Outfitters-New-Theme.myshopify.com:
[]
2023-03-22T15:40:23.195Z: Getting session store...
2023-03-22T15:40:23.197Z: 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": "CCK-Outfitters-New-Theme.myshopify.com"
}
}
2023-03-22T15:40:23.197Z: Sending Identity Introspection request to URL: https://accounts.shopify.com/oauth/introspection
2023-03-22T15:40:23.197Z: Sending POST request to URL https://accounts.shopify.com/oauth/introspection
With request headers:
- User-Agent: Shopify CLI; v=3.44.1
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-03-22T15:40:23.383Z: Request to https://accounts.shopify.com/oauth/introspection completed in 181 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/"60d8375534928681d48af2f67db54a89"
- x-request-id: c671606a-1360-433f-887c-a840da3c4715
2023-03-22T15:40:23.386Z: The identity token is valid: true
2023-03-22T15:40:23.386Z:
The validation of the token for application/identity completed with the following results:
- It's expired: false
- It's invalid in identity: false
2023-03-22T15:40:23.386Z: The current session is valid but needs refresh. Refreshing...
2023-03-22T15:40:23.387Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=refresh_token&access_token=atkn_f4c38e1e0ca5854503eea487b641cb6345cd2bd9a42df06210a7424f586e8969&refresh_token=atkn_c15816ecfbd7c20b33b94e815ce11fc3ea6480186f178f5ba136660b32f8ea9e&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3
With request headers:
- User-Agent: Shopify CLI; v=3.44.1
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-03-22T15:40:23.736Z: Request to https://accounts.shopify.com/oauth/token?grant_type=refresh_token&access_token=atkn_f4c38e1e0ca5854503eea487b641cb6345cd2bd9a42df06210a7424f586e8969&refresh_token=atkn_c15816ecfbd7c20b33b94e815ce11fc3ea6480186f178f5ba136660b32f8ea9e&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3 completed in 347 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/"02e658a7552bc733eaecd2e9bbb535c5"
- x-request-id: 588fde63-95f7-4ea9-a329-719dd48412bf
2023-03-22T15:40:23.738Z: 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_eef0d1215d7bcad20de8eb54e65214af3d9c88e208d5937e4ff89fe7023d49d2
With request headers:
- User-Agent: Shopify CLI; v=3.44.1
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-03-22T15:40:23.739Z: 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_eef0d1215d7bcad20de8eb54e65214af3d9c88e208d5937e4ff89fe7023d49d2
With request headers:
- User-Agent: Shopify CLI; v=3.44.1
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-03-22T15:40:23.931Z: 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_eef0d1215d7bcad20de8eb54e65214af3d9c88e208d5937e4ff89fe7023d49d2 completed in 191 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/"a137dd14339ad3217927ddf619a7df0b"
- x-request-id: 703de277-d914-4fa8-8b56-cbf55c8b7b5d
2023-03-22T15:40:24.158Z: 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_eef0d1215d7bcad20de8eb54e65214af3d9c88e208d5937e4ff89fe7023d49d2 completed in 417 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/"0aa63f23f3033235810abf6d3c7b66f5"
- x-request-id: 42104d35-4bde-40f6-ba3d-78eb47f5fe16
2023-03-22T15:40:24.161Z: 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_eef0d1215d7bcad20de8eb54e65214af3d9c88e208d5937e4ff89fe7023d49d2&destination=https%3A%2F%2FCCK-Outfitters-New-Theme.myshopify.com%2Fadmin
With request headers:
- User-Agent: Shopify CLI; v=3.44.1
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-03-22T15:40:24.415Z: 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_eef0d1215d7bcad20de8eb54e65214af3d9c88e208d5937e4ff89fe7023d49d2&destination=https%3A%2F%2FCCK-Outfitters-New-Theme.myshopify.com%2Fadmin completed in 252 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/"7c02137f2939f492903c526f86d1ac9d"
- x-request-id: b317e613-b63d-459b-bc8e-a8e2b2408701
2023-03-22T15:40:24.417Z: Setting session store...
2023-03-22T15:40:24.437Z: Getting development theme...
2023-03-22T15:40:24.782Z: Request to https://cck-outfitters-new-theme.myshopify.com/admin/api/unstable/themes/146387009835.json?fields=id completed in 343 ms
With response headers:
- content-type: application/json; charset=utf-8
- x-request-id: b303c2ae-80e1-4fff-ba90-0ce22a82000b
2023-03-22T15:40:24.786Z: Ensuring that the user is authenticated with the Storefront API with the following scopes:
[]
2023-03-22T15:40:24.786Z: Getting session store...
2023-03-22T15:40:24.787Z: 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-03-22T15:40:24.787Z: Sending Identity Introspection request to URL: https://accounts.shopify.com/oauth/introspection
2023-03-22T15:40:24.788Z: Sending POST request to URL https://accounts.shopify.com/oauth/introspection
With request headers:
- User-Agent: Shopify CLI; v=3.44.1
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-03-22T15:40:24.798Z: Obtaining the dependency manager in directory ../.....
2023-03-22T15:40:24.802Z:
Running system process:
· Command: /opt/homebrew/opt/ruby/bin/ruby -v
· Working directory: /Users/claykelly/Projects/test-shopify
2023-03-22T15:40:24.928Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 115 ms
With response headers:
- x-request-id: df4c45c4-8cff-49f1-a9ad-8cdd65d9b1dd
2023-03-22T15:40:24.929Z: Analytics event sent: {
"command": "theme dev",
"time_start": 1679499623169,
"time_end": 1679499624794,
"total_time": 1625,
"success": true,
"cli_version": "3.44.1",
"ruby_version": "3.2.1",
"node_version": "19.8.1",
"is_employee": false,
"uname": "darwin arm64",
"env_ci": false,
"env_plugin_installed_any_custom": false,
"env_plugin_installed_shopify": "[\"@shopify/cli\",\"@shopify/plugin-did-you-mean\",\"@shopify/theme\"]",
"env_shell": "zsh",
"env_device_id": "4e8467edaee8963943bb13d6fefdef5ba227b4de",
"env_cloud": "localhost",
"env_package_manager": "yarn",
"cmd_all_launcher": "unknown",
"cmd_all_topic": "theme",
"cmd_all_plugin": "@shopify/theme",
"args": "--verbose",
"env_plugin_installed_all": "[\"@shopify/cli\",\"@shopify/plugin-did-you-mean\",\"@shopify/theme\"]",
"metadata": "{\"extraPublic\":{},\"extraSensitive\":{}}"
}
2023-03-22T15:40:24.929Z: Completed command theme dev
2023-03-22T15:40:24.959Z: Request to https://accounts.shopify.com/oauth/introspection completed in 170 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/"ba002af31ccf9ddf690c6988264081db"
- x-request-id: c515981f-b733-49fe-9188-5031e2b41f8d
2023-03-22T15:40:24.960Z: The identity token is valid: true
2023-03-22T15:40:24.960Z:
The validation of the token for application/identity completed with the following results:
- It's expired: false
- It's invalid in identity: false
2023-03-22T15:40:24.965Z:
Running system process:
· Command: /opt/homebrew/opt/ruby/bin/ruby -v
· Working directory: /Users/claykelly/Projects/test-shopify
2023-03-22T15:40:24.975Z:
Running system process:
· Command: /opt/homebrew/opt/ruby/bin/bundle -v
· Working directory: /Users/claykelly/Projects/test-shopify
2023-03-22T15:40:25.061Z: Reading the content of file at /opt/homebrew/Cellar/shopify-cli/3.44.1/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/Gemfile...
2023-03-22T15:40:25.062Z:
Running system process:
· Command: /opt/homebrew/opt/ruby/bin/bundle install
· Working directory: /opt/homebrew/Cellar/shopify-cli/3.44.1/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby
2023-03-22T15:40:25.234Z:
Running system process:
· Command: /opt/homebrew/opt/ruby/bin/bundle exec /opt/homebrew/opt/ruby/bin/ruby /opt/homebrew/Cellar/shopify-cli/3.44.1/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify theme serve . --live-reload hot-reload --theme 146387009835
· Working directory: /Users/claykelly/Projects/test-shopify
┏━━ Viewing theme… ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
┃ DEBUG GET https://CCK-Outfitters-New-Theme.myshopify.com/admin/api/unstable/themes.json with X-Request-Id: 2f574d79-1e4d-4258-88ec-b6d422e9e2a7
┃ * Syncing theme #146387009835 on CCK-Outfitters-New-Theme.myshopify.com
┃ DEBUG GET https://CCK-Outfitters-New-Theme.myshopify.com/admin/api/unstable/themes/146387009835/assets.json with X-Request-Id: e4b0f84e-4ed5-4f12-8b41-c38a1ac5853a
┃ 100%
┃
┃ Serving .
┃
┃ Please open this URL in your browser:
┃ http://127.0.0.1:9292
┃
┃ Customize this theme in the Theme Editor, and use 'theme pull' to get the changes:
┃ https://CCK-Outfitters-New-Theme.myshopify.com/admin/themes/146387009835/editor
┃
┃ Share this theme preview:
┃ https://CCK-Outfitters-New-Theme.myshopify.com/?preview_theme_id=146387009835
┃
┃ (Use Ctrl-C to stop)
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ (0.54s) ━━
[2023-03-22 10:40:26] INFO WEBrick 1.7.0
[2023-03-22 10:40:26] INFO ruby 3.2.1 (2023-02-08) [arm64-darwin21]
[2023-03-22 10:40:26] INFO WEBrick::HTTPServer#start: pid=90428 port=9292
CHROME DEV TOOLS OUTPUT:
Reproduction steps
- Pull theme
- run
shopify theme dev
- open given URL (http://127.0.0.1:9292)
- URL redirects to actual theme URL
Operating System
Mac OS Monterey v12.5
Shopify CLI version (check your project’s package.json
if you’re not sure)
3.44.1
Shell
zsh
Node version (run node -v
if you’re not sure)
v18.8.0
What language and version are you using in your application?
Ruby 3.2.1
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 1
- Comments: 46 (8 by maintainers)
I had the same bug. I was able to fix it with the following workaround: I added the parameter ‘preview_theme_id=xxxx’ (xxxx is the theme ID!) to the URL http://127.0.0.1:9292. Now the correct theme is used for the display.
still an issue
Issue still exists
Had the same problem when using: shopify theme dev --store my-store.shopify.com --live-reload hot-reload
After removing the --live-reload flag it seemed to work. After that added the --live-reload flag again and now it still works! Try messing around with flags. Removing them, adding them, etc
The issue still exists. Clicking preview from editor still redirects.
I also started seeing this issue yesterday after ~2 years of no issues. No config changes on my end nor store changes. It also happens on multiple stores.
I am seeing the exact problem mentioned here https://github.com/Shopify/cli/issues/1642#issuecomment-1960309681 however strangely enough when I remove the sync flags as mentioned here https://github.com/Shopify/cli/issues/1642#issuecomment-1935745176 everything works as normal.
At least for me, this seems directly tied to
--theme-editor-sync
Update: Shortly after I posted this it has gone back to reflecting production - regardless of any flags passed or not passed
I’m seeing this issue too. It’s not redirecting for me, but it seems to be serving the production theme on the localhost server.
still active for CLI 3.54.0
Still active.
I’m willing to wager this might be the case. A couple of my juniors reached out today experiencing the same issue out of the blue; so hopefully it goes away as quickly as it came!
Still active.
issue still exists
Issue still exists
Still relevant.
This issue still exists. I’m on CLI 3.45.4 and I have the exact problem as described in this issue. I’m running
shopify theme dev --store=xxxx.myshopify.com
and instead of showing the theme I’m developing, the browser immediately redirects and just shows the live store.As described, I can view the development version when I use the editor link and click “preview”, but this does not solve the problem as I’m missing out on the hot-reload functionality when not using the local http://127.0.0.1:9292.
Yes