Closed Jay-Plumb closed 1 year ago
hey @Jay-Plumb have you tried to deploy once manually from your machine? I believe the first deploy cannot be done on the CI/CD instance.
Hey @Arkham, I did perform a manual deploy locally using npm run deploy -- -f
which shows the deployments automatically versioning:
great! so what happens if you run these commands locally?
npm run shopify auth logout
SHOPIFY_CLI_PARTNERS_TOKEN=your_token SHOPIFY_API_KEY=your_key npm run deploy
@Arkham Running the above commands locally I see the same error as shown in the github action:
> shopify app deploy
No Organization found
Next steps
• Have you created a Shopify Partners organization?
• Have you confirmed your accounts from the emails you received?
• Need to connect to a different App or organization? Run the command again with `--reset`
• Do you have access to the right Shopify Partners organization? The CLI is loading this
organization
The CLI is loading "this organization" does point to the correct organisation that contains the UI app extension and the generated
SHOPIFY_CLI_PARTNERS_TOKEN
@Arkham
I think there might be some issues with the permissions. I was facing the same issue.
But if we generate a token with "Functions" access, I'm able to deploy the extensions. I am not able to deploy the extensions with just "UI Extensions" access.
For now, I have generated a token with "UI Extension" access and "Functions" access.
hey @dev-prakhar really good find, I was about to recommend that generating a new token with both extensions and functions support should work. I'm still investigating why having only extensions is not working.
@dev-prakhar @Arkham Thanks both. The token was generated without the function checked so for now I will generate a new token with both checked for a temp solution
@Arkham Just ran the following command locally with the new SHOPIFY_CLI_PARTNERS_TOKEN
generated with both UI Extensions and Functions checked:
npm run shopify auth logout
SHOPIFY_CLI_PARTNERS_TOKEN=your_token SHOPIFY_API_KEY=your_key npm run deploy
The following error is different from previous:
│
│ request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agr │
│ ant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aacces │
│ s_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fb │
│ db2649-e327-4907-8f67-908d24cfd7e3&audience=271e16d403dfa18082ffb3d197bd2b5f4479c3fc32736d69296 │
│ 829cbb28d41a6&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.app.cli.access&subject_toke │
│ n=xx failed, reason: │
│ getaddrinfo ENOTFOUND accounts.shopify.com
that seems to be a DNS issue, can you try opening https://accounts.shopify.com/ in your browser, restarting your network, etc?
yeah looks like a few sites are down in Asia ATM. I'll give it another try tomorrow morning. Thanks!
This should be fixed, so that a partners token that only has extensions
permissions works. Thanks for reporting and providing workarounds folks!
@Arkham still not working for me. Here is the latest error:
╭─ error ──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ │
│ To investigate the issue, examine this stack trace: │
│ at tokenRequestErrorHandler (@shopify/cli-kit/src/private/node/session/exchange.ts:174) │
│ return new InvalidRequestError() │
│ at mapError (@shopify/cli-kit/src/public/node/result.ts:142) │
│ return err(mapper(this.error)) │
│ at requestAppToken (@shopify/cli-kit/src/private/node/session/exchange.ts:153) │
│ const value = tokenResult.mapError(tokenRequestErrorHandler).valueOrBug() │
│ at processTicksAndRejections (node:internal/process/task_queues:95) │
│ at async exchangeCustomPartnerToken (@shopify/cli-kit/src/private/node/session/exchange.ts:92) │
│ const newToken = await requestAppToken('partners', token, │
│ ['https://api.shopify.com/auth/partners.app.cli.access']) │
│ at async ensureAuthenticatedPartners (@shopify/cli-kit/src/public/node/session.ts:32) │
│ return (await exchangeCustomPartnerToken(envToken)).accessToken │
│ at async ensureDeployContext (@shopify/app/src/cli/services/context.ts:317) │
│ const token = await ensureAuthenticatedPartners() │
│ at async deploy (@shopify/app/src/cli/services/deploy.ts:64) │
│ let {app, identifiers, partnersApp, token, deploymentMode} = await ensureDeployContext(options) │
│ at run (@shopify/app/src/cli/commands/app/deploy.ts:95) │
│ await deploy({ │
│
@Arkham here is the full stack trace:
Command ran locally:
SHOPIFY_CLI_PARTNERS_TOKEN=xxx SHOPIFY_API_KEY=xxx npm run deploy -- -f --verbose
Stack Trace
> shopify app deploy -f --verbose
2023-08-02T01:05:46.227Z: Running command app deploy
2023-08-02T01:05:46.301Z: Reading cached app information for directory /Users/jasonplumb/pixelcabin/extensions/ci-cd-extension...
2023-08-02T01:05:46.303Z: Reading the content of file at shopify.app.toml...
2023-08-02T01:05:46.307Z: Reading the content of file at shopify.app.toml...
2023-08-02T01:05:46.318Z: Reading the content of file at shopify.app.toml...
2023-08-02T01:05:46.386Z: Reading the .env file at .env
2023-08-02T01:05:46.387Z: Reading the content of file at .env...
2023-08-02T01:05:46.392Z: Reading the content of file at extensions/checkout-ui-banner/shopify.extension.toml...
2023-08-02T01:05:46.397Z: Reading the content of file at extensions/checkout-ui-banner/shopify.extension.toml...
2023-08-02T01:05:46.404Z: Reading the content of file at package.json...
2023-08-02T01:05:46.406Z: Reading the content of file at package.json...
2023-08-02T01:05:46.408Z: Obtaining the dependency manager in directory /Users/jasonplumb/pixelcabin/extensions/ci-cd-extension...
2023-08-02T01:05:46.425Z: Reading the content of file at package.json...
2023-08-02T01:05:46.426Z: Unable to decide project type as no web backend
2023-08-02T01:05:46.429Z: Ensuring that the user is authenticated with the Partners API with the following scopes:
[]
2023-08-02T01:05:46.432Z: 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=xxx
With request headers:
- User-Agent: Shopify CLI; v=3.48.0
- Keep-Alive: timeout=30
- Sec-CH-UA-PLATFORM: darwin
- Content-Type: application/json
2023-08-02T01:05:46.766Z: 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=xxx completed in 325 ms
With response headers:
- cache-control: no-cache, no-store, private, must-revalidate, max-age=0
- content-type: application/json; charset=utf-8
- x-request-id: d52d629f-8906-4036-9696-d6f253aff4a0
╭─ error ──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ │
│ To investigate the issue, examine this stack trace: │
│ at tokenRequestErrorHandler (@shopify/cli-kit/src/private/node/session/exchange.ts:174) │
│ return new InvalidRequestError() │
│ at mapError (@shopify/cli-kit/src/public/node/result.ts:142) │
│ return err(mapper(this.error)) │
│ at requestAppToken (@shopify/cli-kit/src/private/node/session/exchange.ts:153) │
│ const value = tokenResult.mapError(tokenRequestErrorHandler).valueOrBug() │
│ at processTicksAndRejections (node:internal/process/task_queues:95) │
│ at async exchangeCustomPartnerToken (@shopify/cli-kit/src/private/node/session/exchange.ts:92) │
│ const newToken = await requestAppToken('partners', token, │
│ ['https://api.shopify.com/auth/partners.app.cli.access']) │
│ at async ensureAuthenticatedPartners (@shopify/cli-kit/src/public/node/session.ts:32) │
│ return (await exchangeCustomPartnerToken(envToken)).accessToken │
│ at async ensureDeployContext (@shopify/app/src/cli/services/context.ts:317) │
│ const token = await ensureAuthenticatedPartners() │
│ at async deploy (@shopify/app/src/cli/services/deploy.ts:64) │
│ let {app, identifiers, partnersApp, token, deploymentMode} = await ensureDeployContext(options) │
│ at run (@shopify/app/src/cli/commands/app/deploy.ts:95) │
│ await deploy({ │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯
2023-08-02T01:05:46.934Z: Obtaining the dependency manager in directory /Users/jasonplumb/pixelcabin/extensions/ci-cd-extension...
2023-08-02T01:05:46.939Z:
Running system process:
· Command: ruby -v
· Working directory: /Users/jasonplumb/pixelcabin/extensions/ci-cd-extension
2023-08-02T01:05:46.945Z: Obtaining the dependency manager in directory /Users/jasonplumb/pixelcabin/extensions/ci-cd-extension...
2023-08-02T01:05:46.955Z:
Running system process:
· Command: ruby -v
· Working directory: /Users/jasonplumb/pixelcabin/extensions/ci-cd-extension
2023-08-02T01:05:47.277Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 312 ms
With response headers:
- x-request-id: 0f8ca415-f9d0-4999-b830-f5d1f725c490
2023-08-02T01:05:47.281Z: Analytics event sent: {
"command": "app deploy",
"time_start": 1690938346228,
"time_end": 1690938346942,
"total_time": 714,
"success": true,
"cli_version": "3.48.0",
"ruby_version": "3.0.5",
"node_version": "18.15.0",
"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": "7f3fc8d3985013f0dc47382561e3d8c0fcbe5aa1",
"env_cloud": "localhost",
"env_package_manager": "npm",
"cmd_app_warning_api_key_deprecation_displayed": false,
"cmd_deploy_flag_message_used": false,
"cmd_deploy_flag_version_used": false,
"cmd_deploy_flag_source_url_used": false,
"app_extensions_any": true,
"app_extensions_breakdown": "{\"ui_extension\":1}",
"app_extensions_count": 1,
"app_extensions_custom_layout": false,
"app_extensions_function_any": false,
"app_extensions_function_count": 0,
"app_extensions_theme_any": false,
"app_extensions_theme_count": 0,
"app_extensions_ui_any": true,
"app_extensions_ui_count": 1,
"app_name_hash": "8e5e0e67d3b72bc4b70bd681afb27c180806f93e",
"app_path_hash": "5d95bc5b6ac8050c016d2c41eeb8deb15152a8e7",
"app_scopes": "[\"write_products\"]",
"app_web_backend_any": false,
"app_web_backend_count": 0,
"app_web_custom_layout": false,
"app_web_frontend_any": false,
"app_web_frontend_count": 0,
"env_package_manager_workspaces": true,
"cmd_app_all_configs_any": true,
"cmd_app_all_configs_clients": "{\"shopify.app.toml\":\"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": "npm",
"cmd_all_topic": "app",
"cmd_all_plugin": "@shopify/app",
"cmd_all_verbose": true,
"cmd_all_path_override": true,
"cmd_all_path_override_hash": "5d95bc5b6ac8050c016d2c41eeb8deb15152a8e7",
"cmd_app_reset_used": false,
"args": "-f --verbose",
"app_name": "ci-cd-extension",
"env_plugin_installed_all": "[\"@shopify/app\",\"@shopify/cli\",\"@shopify/plugin-cloudflare\",\"@shopify/plugin-did-you-mean\"]",
"metadata": "{\"extraPublic\":{},\"extraSensitive\":{}}"
}
2023-08-02T01:05:47.283Z: Completed command app deploy
2023-08-02T01:05:47.293Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 342 ms
With response headers:
- x-request-id: 194ef86e-563d-4932-a5e8-ca6d08629005
2023-08-02T01:05:47.296Z: Analytics event sent: {
"command": "app deploy",
"time_start": 1690938346228,
"time_end": 1690938346917,
"total_time": 689,
"success": false,
"cli_version": "3.48.0",
"ruby_version": "3.0.5",
"node_version": "18.15.0",
"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": "7f3fc8d3985013f0dc47382561e3d8c0fcbe5aa1",
"env_cloud": "localhost",
"env_package_manager": "npm",
"cmd_app_warning_api_key_deprecation_displayed": false,
"cmd_deploy_flag_message_used": false,
"cmd_deploy_flag_version_used": false,
"cmd_deploy_flag_source_url_used": false,
"app_extensions_any": true,
"app_extensions_breakdown": "{\"ui_extension\":1}",
"app_extensions_count": 1,
"app_extensions_custom_layout": false,
"app_extensions_function_any": false,
"app_extensions_function_count": 0,
"app_extensions_theme_any": false,
"app_extensions_theme_count": 0,
"app_extensions_ui_any": true,
"app_extensions_ui_count": 1,
"app_name_hash": "8e5e0e67d3b72bc4b70bd681afb27c180806f93e",
"app_path_hash": "5d95bc5b6ac8050c016d2c41eeb8deb15152a8e7",
"app_scopes": "[\"write_products\"]",
"app_web_backend_any": false,
"app_web_backend_count": 0,
"app_web_custom_layout": false,
"app_web_frontend_any": false,
"app_web_frontend_count": 0,
"env_package_manager_workspaces": true,
"cmd_app_all_configs_any": true,
"cmd_app_all_configs_clients": "{\"shopify.app.toml\":\"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": "npm",
"cmd_all_topic": "app",
"cmd_all_plugin": "@shopify/app",
"cmd_all_verbose": true,
"cmd_all_path_override": true,
"cmd_all_path_override_hash": "5d95bc5b6ac8050c016d2c41eeb8deb15152a8e7",
"cmd_app_reset_used": false,
"args": "-f --verbose",
"error_message": "",
"app_name": "ci-cd-extension",
"env_plugin_installed_all": "[\"@shopify/app\",\"@shopify/cli\",\"@shopify/plugin-cloudflare\",\"@shopify/plugin-did-you-mean\"]",
"metadata": "{\"extraPublic\":{},\"extraSensitive\":{}}"
}
2023-08-02T01:05:47.343Z: Obtaining the dependency manager in directory /Users/jasonplumb/pixelcabin/extensions/ci-cd-extension...
the token seems invalid, can you try generating a new one?
@Arkham the token was valid and had both Function and ui extensions checked. I have since created a new token with just UI extension checked and all works now. Thanks for the help all!
maybe it was because the CLI caches some authentication token to avoid making unnecessary requests, and the cached value had become invalid? having a token with both extensions
and functions
should work just as well (I just tested it) :)
@Arkham that would make sense. Thanks for testing all cases on your end
Please confirm that you have:
In which of these areas are you experiencing a problem?
Extension
Expected behavior
For CI/CD I have the following code:
Both
SHOPIFY_CLI_PARTNERS_TOKEN
andSHOPIFY_API_KEY
are defined as a secret and pulled from the shopify partner dashboard and from the .env file generated.Actual behavior
Error: No Organization found
Next steps
• Have you created a Shopify Partners organization [1]?
• Have you confirmed your accounts from the emails you received?
• Need to connect to a different App or organization? Run the command
again with
--reset
• Do you have access to the right Shopify Partners organization? The CLI
[1] https://partners.shopify.com/signup [2] https://partner.shopify.com/116440
Verbose output
Reproduction steps
Operating System
Ubuntu 22.04.2 LTS
Shopify CLI version (check your project's
package.json
if you're not sure)"@shopify/cli": "3.48.0", "@shopify/app": "3.48.0",
Shell
No response
Node version (run
node -v
if you're not sure)v18
What language and version are you using in your application?
"@remix-run/node": "^1.19.1"