-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Cannot skip login via browser using SHOPIFY_CLI_DEVICE_AUTH=1 #4495
Comments
Also have this error when running shopify app dev inside a docker container |
Experiencing the same issue within a docker container |
@sillycube do you know which shopify cli version works with SHOPIFY_CLI_DEVICE_AUTH flag? I just want to turn on the development mode for my app and run some automation tests with my development store in CI...it's so hard with this shopify cli. |
Shopify CLI 3.61.0 |
Another workaround is to add a dummy executable named |
Thanks for your suggestion. Can you give me an example on how to add the dummy executable? Or what command to run? |
For example, you can create an executable like this: mkdir ~/tmp-bin && export PATH=$PATH:~/tmp-bin && echo "#!/bin/sh" > ~/tmp-bin/xdg-open && chmod +x ~/tmp-bin/xdg-open |
This script works well; however, I recommend Bash users replace the |
Please confirm that you have:
In which of these areas are you experiencing a problem?
App
Expected behavior
I was using SHOPIFY_CLI_DEVICE_AUTH=1 to run npm run dev. Previously, it could work for login in my remote server, which couldn't open a browser GUI. After a while, I upgraded my CLI to the latest version and I couldn't login with
SHOPIFY_CLI_DEVICE_AUTH=1 npm run dev
. I was logged on before but I was logged out suddenly. I don't know why it was.Is this option still working? Did I miss anything?
Actual behavior
bennychan:~/abc$ SHOPIFY_CLI_ACCESS_CODE_AUTH=1 npm run dev -- --theme 1234
To run this command, log in to Shopify.
👉 Press any key to open the login page on your browser
Error: spawn xdg-open ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Verbose output
bennychan@Dev:~/myProject$ SHOPIFY_CLI_DEVICE_AUTH=1 shopify app dev --verbose
2024-09-28T10:07:21.393Z: Running command app dev
2024-09-28T10:07:21.430Z: Getting a random port...
2024-09-28T10:07:21.443Z: Random port obtained: 41035
2024-09-28T10:07:21.478Z: cloudflared already installed, skipping
2024-09-28T10:07:21.494Z:
Running system process:
· Command: /home/bennychan/.nvm/versions/node/v21.6.2/lib/node_modules/@shopify/cli/bin/cloudflared tunnel --url http://localhost:41035 --no-autoupdate
· Working directory: /home/bennychan/myProject
2024-09-28T10:07:21.513Z: Reading cached app information for directory /home/bennychan/myProject...
2024-09-28T10:07:21.515Z: 2024-09-28T10:07:21Z INF Thank you for trying Cloudflare Tunnel. Doing so, without a Cloudflare account, is a quick way to experiment and try it out. However, be aware that these account-less Tunnels have no uptime guarantee. If you intend to use Tunnels in production you should use a pre-created named tunnel by following: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps
2024-09-28T10:07:21Z INF Requesting new quick Tunnel on trycloudflare.com...
2024-09-28T10:07:21.521Z: Reading the content of file at shopify.app.toml...
2024-09-28T10:07:21.534Z: Reading the content of file at shopify.app.toml...
2024-09-28T10:07:21.546Z: Reading the content of file at shopify.app.myProject.toml...
2024-09-28T10:07:21.624Z: Reading cached app information for directory /home/bennychan/myProject...
2024-09-28T10:07:21.626Z: Reading cached app information for directory /home/bennychan/myProject...
2024-09-28T10:07:21.629Z: Reading cached app information for directory /home/bennychan/myProject...
2024-09-28T10:07:21.632Z: Reading the content of file at shopify.app.toml...
2024-09-28T10:07:21.635Z: Reading the content of file at shopify.app.toml...
2024-09-28T10:07:21.644Z: Reading the content of file at shopify.app.myProject.toml...
2024-09-28T10:07:21.712Z: Ensuring that the user is authenticated with the Partners API with the following scopes:
[]
2024-09-28T10:07:21.713Z: Getting session store...
2024-09-28T10:07:21.715Z: 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:
{
"partnersApi": {
"scopes": []
}
}
2024-09-28T10:07:21.716Z: Initiating the full authentication flow...
2024-09-28T10:07:21.717Z: Requesting device authorization code...
2024-09-28T10:07:21.721Z: Sending POST request to URL https://accounts.shopify.com/oauth/device_authorization
With request headers:
2024-09-28T10:07:22.109Z: Request to https://accounts.shopify.com/oauth/device_authorization completed in 386 ms
With response headers:
2024-09-28T10:07:22.116Z: Received device authorization code: {
"verification_uri": "https://shopify.com/activate",
"verification_uri_complete": "https://accounts.shopify.com/activate-with-code?device_code%5Buser_code%5D=SZWQ-BRVQ",
"expires_in": 599,
"interval": 5,
"device_code": "e75f772e-fc22-47d1-98e9-0ba5e80e23d2",
"user_code": "SZWQ-BRVQ"
}
To run this command, log in to Shopify.
User verification code: SZWQ-BRVQ
👉 Press any key to open the login page on your browser
2024-09-28T10:07:26.255Z: 2024-09-28T10:07:26Z INF +--------------------------------------------------------------------------------------------+
2024-09-28T10:07:26Z INF | Your quick Tunnel has been created! Visit it at (it may take some time to be reachable): |
2024-09-28T10:07:26Z INF | https://popular-prerequisite-aud-pod.trycloudflare.com |
2024-09-28T10:07:26Z INF +--------------------------------------------------------------------------------------------+
2024-09-28T10:07:26.256Z: 2024-09-28T10:07:26Z INF Cannot determine default configuration path. No file [config.yml config.yaml] in [~/.cloudflared ~/.cloudflare-warp ~/cloudflare-warp /etc/cloudflared /usr/local/etc/cloudflared]
2024-09-28T10:07:26Z INF Version 2024.8.2
2024-09-28T10:07:26Z INF GOOS: linux, GOVersion: go1.22.2, GoArch: amd64
2024-09-28T10:07:26Z INF Settings: map[ha-connections:1 no-autoupdate:true protocol:quic url:http://localhost:41035]
2024-09-28T10:07:26.256Z: 2024-09-28T10:07:26Z INF Generated Connector ID: 2682ce3b-65c9-4081-8f0f-fd5eaa7f17d5
2024-09-28T10:07:26.258Z: 2024-09-28T10:07:26Z INF cloudflared will not automatically update if installed by a package manager.
2024-09-28T10:07:26.275Z: 2024-09-28T10:07:26Z INF Initial protocol quic
2024-09-28T10:07:26Z INF ICMP proxy will use 165.22.48.235 as source for IPv4
2024-09-28T10:07:26Z INF ICMP proxy will use fe80::6821:d4ff:feb3:9ad9 in zone eth0 as source for IPv6
2024-09-28T10:07:26.288Z: 2024-09-28T10:07:26Z INF Starting metrics server on 127.0.0.1:41205/metrics
2024-09-28T10:07:26.339Z: 2024-09-28T10:07:26Z WRN Your version 2024.8.2 is outdated. We recommend upgrading it to 2024.9.1
2024-09-28T10:07:26.928Z: 2024-09-28T10:07:26Z INF Registered tunnel connection connIndex=0 connection=597e3c6d-bc19-4e26-89a6-ebcdd294b4ec event=0 ip=198.41.200.53 location=sin12 protocol=quic
Reproduction steps
When I run the command
SHOPIFY_CLI_DEVICE_AUTH=1 npm run dev
, it shows me "👉 Press any key to open the login page on your browser". When I press any key, it shows the error.Operating System
Ubuntu 20.04
Shopify CLI version (check your project's
package.json
if you're not sure)3.67.1, local Shopify CLI.
But it's still the same when I switch to global Shopify CLI
Shell
No response
Node version (run
node -v
if you're not sure)v21.6.2
What language and version are you using in your application?
No response
The text was updated successfully, but these errors were encountered: