cli: [Bug]: Connection fails to https://partners.shopify.com/api/cli/graphql failed, reason: read ECONNRESET
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?
Extension
Expected behavior
Expect to connect to https://partners.shopify.com/api/cli/graphql and be able to cloudflare tunnel setup to developer Shopify checkout extension.
Actual behavior
Has been working fine for weaks. Then one day.
Connection fails with following message.
request to https://partners.shopify.com/api/cli/graphql failed, reason: read ECONNRESET
- Node v18.18.1 via NVM
- ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin22]
- Current Shopify CLI version: 3.49.7 via node_modules folder
It seems to me that my device + ip have been restricted by the api end point. Shopify Support asked me to leave a ticket here.
shopify-cli log
$ ./node_modules/@shopify/cli/bin/run.js app dev --verbose
2023-10-13T04:22:19.872Z: Running command app dev
2023-10-13T04:22:19.882Z: Getting a random port...
2023-10-13T04:22:19.887Z: Random port obtained: 61644
2023-10-13T04:22:19.902Z:
Running system process:
· Command: /path/to/extension/node_modules/@shopify/plugin-cloudflare/bin/cloudflared tunnel --url http://localhost:61644 --no-autoupdate
· Working directory: /path/to/extension
2023-10-13T04:22:19.906Z: Ensuring that the user is authenticated with the Partners API with the following scopes:
[]
2023-10-13T04:22:19.907Z: Getting session store...
2023-10-13T04:22:19.911Z: 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": []
}
}
2023-10-13T04:22:19.913Z: Sending GET request to URL https://accounts.shopify.com/.well-known/openid-configuration.json
With request headers:
- User-Agent: Shopify CLI; v=3.49.7
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-10-13T04:22:19.927Z: Cloudflared tunnel crashed: Command failed with ENOENT: /path/to/extension/node_modules/@shopify/plugin-cloudflare/bin/cloudflared tunnel --url http://localhost:61644 --no-autoupdate
spawn /path/to/extension/node_modules/@shopify/plugin-cloudflare/bin/cloudflared ENOENT, restarting...
2023-10-13T04:22:20.285Z: Request to https://accounts.shopify.com/.well-known/openid-configuration.json completed in 365 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/"1eb4e9d462ffcdab29ed596345fa4cb0"
- x-request-id: 783e98c1-500c-499a-816a-cbc52ad8a488
2023-10-13T04:22:20.298Z: Sending Identity Introspection request to URL: https://accounts.shopify.com/oauth/introspection
2023-10-13T04:22:20.300Z: Sending POST request to URL https://accounts.shopify.com/oauth/introspection
With request headers:
- User-Agent: Shopify CLI; v=3.49.7
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-10-13T04:22:20.676Z: Request to https://accounts.shopify.com/oauth/introspection completed in 370 ms
With response headers:
- cache-control: no-cache
- content-type: text/html
- x-request-id: c0f5051f-4c17-4319-853c-45e12b072050
2023-10-13T04:22:20.679Z: The Introspection request failed with:
- status: 401
- www-authenticate header: "error=\"invalid_token\",error_description=\"The access token provided is expired, revoked, malformed or invalid for other reasons.\""
- body: ""
2023-10-13T04:22:20.681Z:
The validation of the token for application/identity completed with the following results:
- It's expired: true
- It's invalid in identity: true
2023-10-13T04:22:20.681Z: The current session is valid but needs refresh. Refreshing...
2023-10-13T04:22:20.684Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=refresh_token&access_token=atkn_af9f16834477ca77163ceb6966074c1a0811ed732f4c7cc0976367651098b1b8&refresh_token=atkn_be0df221628c62795bca5d3226c7b12961ad3b436eefa2fd7de93d6596bc439f&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3
With request headers:
- User-Agent: Shopify CLI; v=3.49.7
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-10-13T04:22:20.934Z:
Running system process:
· Command: /path/to/extension/node_modules/@shopify/plugin-cloudflare/bin/cloudflared tunnel --url http://localhost:61644 --no-autoupdate
· Working directory: /path/to/extension
2023-10-13T04:22:20.943Z: Cloudflared tunnel crashed: Command failed with ENOENT: /path/to/extension/node_modules/@shopify/plugin-cloudflare/bin/cloudflared tunnel --url http://localhost:61644 --no-autoupdate
spawn /path/to/extension/node_modules/@shopify/plugin-cloudflare/bin/cloudflared ENOENT, restarting...
2023-10-13T04:22:21.185Z: Request to https://accounts.shopify.com/oauth/token?grant_type=refresh_token&access_token=atkn_af9f16834477ca77163ceb6966074c1a0811ed732f4c7cc0976367651098b1b8&refresh_token=atkn_be0df221628c62795bca5d3226c7b12961ad3b436eefa2fd7de93d6596bc439f&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3 completed in 493 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/"1adf132ec80d7a37db20e8ec067aab9c"
- x-request-id: 01d9e685-8607-423c-bb03-4491bf494bd3
2023-10-13T04:22:21.199Z: 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.49.7
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-10-13T04:22:21.201Z: 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.49.7
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-10-13T04:22:21.201Z: 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.49.7
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-10-13T04:22:21.575Z: 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 368 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/"16fba49aa9e3caa5e93a31d5dac9e666"
- x-request-id: 61151065-05b9-4de7-8d59-43b061d44d62
2023-10-13T04:22:21.825Z: 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 616 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/"675f0c1ecb3f1e6bb14984200664b8d3"
- x-request-id: 1a82a4f4-33f9-4563-bcf2-8f352d1748c9
2023-10-13T04:22:21.951Z:
Running system process:
· Command: /path/to/extension/node_modules/@shopify/plugin-cloudflare/bin/cloudflared tunnel --url http://localhost:61644 --no-autoupdate
· Working directory: /path/to/extension
2023-10-13T04:22:21.956Z: Cloudflared tunnel crashed: Command failed with ENOENT: /path/to/extension/node_modules/@shopify/plugin-cloudflare/bin/cloudflared tunnel --url http://localhost:61644 --no-autoupdate
spawn /path/to/extension/node_modules/@shopify/plugin-cloudflare/bin/cloudflared ENOENT, restarting...
2023-10-13T04:22:22.102Z: 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 887 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/"19d18df95dcf9be6dee0fb4f81f010d7"
- x-request-id: e4496430-c18a-4d05-8166-6d35a8638a95
2023-10-13T04:22:22.105Z: Setting session store...
2023-10-13T04:22:22.114Z: Verifying that the user has a Partner organization
2023-10-13T04:22:22.120Z: Sending "Partners" GraphQL request:
{
organizations(first: 1) {
nodes {
id
}
}
}
With request headers:
- User-Agent: Shopify CLI; v=3.49.7
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-10-13T04:22:22.296Z: Request to https://partners.shopify.com/api/cli/graphql completed in 157 ms
With response headers:
2023-10-13T04:22:22.302Z: Reading cached app information for directory /path/to/extension...
2023-10-13T04:22:22.322Z: Reading cached app information for directory /path/to/extension...
2023-10-13T04:22:22.330Z: Reading cached app information for directory /path/to/extension...
2023-10-13T04:22:22.332Z: Reading the content of file at shopify.app.toml...
2023-10-13T04:22:22.338Z: Reading the content of file at shopify.app.toml...
2023-10-13T04:22:22.348Z: Reading the content of file at shopify.app.toml...
2023-10-13T04:22:22.440Z: Sending "Partners" GraphQL request:
query FindApp($apiKey: String!) {
app(apiKey: $apiKey) {
id
title
apiKey
organizationId
apiSecretKeys {
secret
}
appType
grantedScopes
betas {
unifiedAppDeployment
}
applicationUrl
redirectUrlWhitelist
requestedAccessScopes
webhookApiVersion
embedded
posEmbedded
preferencesUrl
gdprWebhooks {
customerDeletionUrl
customerDataRequestUrl
shopDeletionUrl
}
appProxy {
subPath
subPathPrefix
url
}
developmentStorePreviewEnabled
}
}
With variables:
{
"apiKey": "*****"
}
With request headers:
- User-Agent: Shopify CLI; v=3.49.7
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-10-13T04:22:22.962Z:
Running system process:
· Command: /path/to/extension/node_modules/@shopify/plugin-cloudflare/bin/cloudflared tunnel --url http://localhost:61644 --no-autoupdate
· Working directory: /path/to/extension
2023-10-13T04:22:22.967Z: Cloudflared tunnel crashed: Command failed with ENOENT: /path/to/extension/node_modules/@shopify/plugin-cloudflare/bin/cloudflared tunnel --url http://localhost:61644 --no-autoupdate
spawn /path/to/extension/node_modules/@shopify/plugin-cloudflare/bin/cloudflared ENOENT, restarting...
2023-10-13T04:22:23.680Z: Request to https://partners.shopify.com/api/cli/graphql completed in 1235 ms
With response headers:
- cache-control: max-age=0, private, must-revalidate
- content-type: application/json; charset=utf-8
- etag: W/"33a72dd6701e5c2a222b00c8b4dba93e"
- x-request-id: 4fcf8bf4-d8f0-4b66-93a9-10ba8f214e38
2023-10-13T04:22:23.687Z: Sending "Partners" GraphQL request:
query FindOrganization($id: ID!) {
organizations(id: $id, first: 1) {
nodes {
id
businessName
website
}
}
}
With variables:
{
"id": "626411"
}
With request headers:
- User-Agent: Shopify CLI; v=3.49.7
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-10-13T04:22:23.720Z: Request to https://partners.shopify.com/api/cli/graphql completed in 27 ms
With response headers:
╭─ error ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ request to https://partners.shopify.com/api/cli/graphql failed, reason: read ECONNRESET │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
2023-10-13T04:22:23.786Z: Obtaining the dependency manager in directory /path/to/extension...
2023-10-13T04:22:23.789Z:
Running system process:
· Command: ruby -v
· Working directory: /path/to/extension
2023-10-13T04:22:23.793Z: Obtaining the dependency manager in directory /path/to/extension...
2023-10-13T04:22:23.795Z:
Running system process:
· Command: ruby -v
· Working directory: /path/to/extension
2023-10-13T04:22:23.970Z:
Running system process:
· Command: /path/to/extension/node_modules/@shopify/plugin-cloudflare/bin/cloudflared tunnel --url http://localhost:61644 --no-autoupdate
· Working directory: /path/to/extension
2023-10-13T04:22:23.972Z: Cloudflared tunnel crashed: Command failed with ENOENT: /path/to/extension/node_modules/@shopify/plugin-cloudflare/bin/cloudflared tunnel --url http://localhost:61644 --no-autoupdate
spawn /path/to/extension/node_modules/@shopify/plugin-cloudflare/bin/cloudflared ENOENT, restarting...
2023-10-13T04:22:24.162Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 324 ms
With response headers:
- x-request-id: 1bc7293d-8716-4c38-b5e5-b4d56115611c
2023-10-13T04:22:24.163Z: Analytics event sent: {
"command": "app dev stop",
"time_start": 1697170943791,
"time_end": 1697170943791,
"total_time": 0,
"success": true,
"cli_version": "3.49.7",
"ruby_version": "3.2.2",
"node_version": "18.18.1",
"is_employee": false,
"uname": "darwin amd64",
"env_ci": false,
"env_plugin_installed_any_custom": false,
"env_plugin_installed_shopify": "[\"@shopify/app\",\"@shopify/cli\",\"@shopify/plugin-cloudflare\",\"@shopify/plugin-did-you-mean\"]",
"env_shell": "zsh",
"env_device_id": "1cfcae83034f94a0e3c3b26cedfd857147edb744",
"env_cloud": "localhost",
"env_package_manager": "npm",
"cmd_app_warning_api_key_deprecation_displayed": false,
"cmd_app_all_configs_any": true,
"cmd_app_all_configs_clients": "{\"shopify.app.toml\":\"33dfde22fdf14240e837502d3469c8a9\"}",
"cmd_app_linked_config_used": true,
"cmd_app_linked_config_name": "shopify.app.toml",
"cmd_app_linked_config_git_tracked": true,
"cmd_app_linked_config_source": "cached",
"cmd_all_launcher": "unknown",
"cmd_all_topic": "app",
"cmd_all_plugin": "@shopify/app",
"cmd_all_verbose": true,
"cmd_all_path_override": true,
"cmd_all_path_override_hash": "e33e88c618cab3fd7dac3ceb8c45cf718e69c132",
"cmd_app_dependency_installation_skipped": false,
"cmd_app_reset_used": false,
"args": "--verbose",
"env_plugin_installed_all": "[\"@shopify/app\",\"@shopify/cli\",\"@shopify/plugin-cloudflare\",\"@shopify/plugin-did-you-mean\"]",
"metadata": "{\"extraPublic\":{},\"extraSensitive\":{}}"
}
2023-10-13T04:22:24.164Z: Completed command app dev
2023-10-13T04:22:24.166Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 330 ms
With response headers:
- x-request-id: 682c18be-a5ff-48c3-96ce-17b09692d176
2023-10-13T04:22:24.166Z: Analytics event sent: {
"command": "app dev",
"time_start": 1697170939873,
"time_end": 1697170943773,
"total_time": 3900,
"success": false,
"cli_version": "3.49.7",
"ruby_version": "3.2.2",
"node_version": "18.18.1",
"is_employee": false,
"uname": "darwin amd64",
"env_ci": false,
"env_plugin_installed_any_custom": false,
"env_plugin_installed_shopify": "[\"@shopify/app\",\"@shopify/cli\",\"@shopify/plugin-cloudflare\",\"@shopify/plugin-did-you-mean\"]",
"env_shell": "zsh",
"env_device_id": "REDACTED-XXX",
"env_cloud": "localhost",
"env_package_manager": "npm",
"cmd_app_warning_api_key_deprecation_displayed": false,
"cmd_app_all_configs_any": true,
"cmd_app_all_configs_clients": "{\"shopify.app.toml\":\"REDACTED-XXX\"}",
"cmd_app_linked_config_used": true,
"cmd_app_linked_config_name": "shopify.app.toml",
"cmd_app_linked_config_git_tracked": true,
"cmd_app_linked_config_source": "cached",
"cmd_all_launcher": "unknown",
"cmd_all_topic": "app",
"cmd_all_plugin": "@shopify/app",
"cmd_all_verbose": true,
"cmd_all_path_override": true,
"cmd_all_path_override_hash": "e33e88c618cab3fd7dac3ceb8c45cf718e69c132",
"cmd_app_dependency_installation_skipped": false,
"cmd_app_reset_used": false,
"args": "--verbose",
"error_message": "request to https://partners.shopify.com/api/cli/graphql failed, reason: read ECONNRESET",
"env_plugin_installed_all": "[\"@shopify/app\",\"@shopify/cli\",\"@shopify/plugin-cloudflare\",\"@shopify/plugin-did-you-mean\"]",
"metadata": "{\"extraPublic\":{},\"extraSensitive\":{}}"
}
Reproduction steps
- Install latest cli
- Setup extension project
- theme app dev
Operating System
MacOS Sonoma 14.0 (23A344)
Shopify CLI version (check your project’s package.json if you’re not sure)
3.49.7
Shell
zsh
Node version (run node -v if you’re not sure)
v18.18.1 via NVM
What language and version are you using in your application?
Node v18.18.1 + ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin22]
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Reactions: 2
- Comments: 19 (7 by maintainers)
Update: My issue has gone away for some reason now.
🤷🏼
Thanks for the information! At least we are sure now that the issue is not about the CLI, but the API. I’ll keep investigating and asking internally.
When you tried with
https://partners.shopify.com/{{ ord_id }}/api/2023-10/graphql.json, it worked without VPN, right? And same authentication?Ok, I think I found the cause. Seems to be working at the moment.
After further digging through logs and debugging, I’ve noticed that
./node_modules/@shopify/plugin-cloudflare/was reporting a crash.After checking the package folder, I found that
bindirectory was missing. For some reason it failed to be generated duringnpm install.I removed
node_modulesfolder and re-rannpm install../node_modules/@shopify/cli/bin/run.js app devis now working as expected. 🥳