cli: [Bug]: CI for Shopify github action to automatically deploy extension fails

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

For CI/CD I have the following code:

# https://shopify.dev/docs/apps/tools/cli/ci-cd
# https://shopify.dev/docs/apps/tools/cli/ci-cd#step-3-integrate-shopify-cli-into-your-pipeline

name: Deploy Extensions
on:
  push:
    branches:
      - main
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v3
        with:
          node-version: 18
          
      - name: Install npm Dependencies
        run: |
          npm install

      - name: Deploy
        env:
          SHOPIFY_CLI_PARTNERS_TOKEN: ${{ secrets.SHOPIFY_CLI_PARTNERS_TOKEN }}
          # .env content - unique to each app
          SHOPIFY_API_KEY: ${{ secrets.SHOPIFY_API_KEY }}
        run: |
          npm run deploy -- -f --verbose

Both SHOPIFY_CLI_PARTNERS_TOKEN and SHOPIFY_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

is loading this organization [2]   

[1] https://partners.shopify.com/signup [2] https://partner.shopify.com/116440

Verbose output

> shopify app deploy -f --verbose

2023-07-31T09:32:46.880Z: Running command app deploy
2023-07-31T09:32:46.964Z: Reading cached app information for directory /home/runner/work/ci/ci...
2023-07-31T09:32:46.966Z: Reading the content of file at shopify.app.toml...
2023-07-31T09:32:46.970Z: Reading the content of file at shopify.app.toml...
2023-07-31T09:32:46.977Z: Reading the content of file at shopify.app.toml...
2023-07-31T09:32:47.058Z: Reading the content of file at extensions/ci-extension/shopify.extension.toml...
2023-07-31T09:32:47.062Z: Reading the content of file at extensions/ci-extension/shopify.extension.toml...
2023-07-31T09:32:47.065Z: Reading the content of file at package.json...
2023-07-31T09:32:47.066Z: Reading the content of file at package.json...
2023-07-31T09:32:47.068Z: Obtaining the dependency manager in directory /home/runner/work/ci/ci...
2023-07-31T09:32:47.076Z: Reading the content of file at shopify.web.toml...
2023-07-31T09:32:47.080Z: Reading the content of file at package.json...
2023-07-31T09:32:47.083Z: Ensuring that the user is authenticated with the Partners API with the following scopes:
[]

2023-07-31T09:32:47.085Z: 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.48.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: linux
 - Content-Type: application/json

2023-07-31T09:32:47.270Z: 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 175 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/"2c65bd4ea4bb7ad609dc2a349fb96592"
 - x-request-id: e88cd08a-c116-41f4-8b21-c8043c84c1ea
    
2023-07-31T09:32:47.277Z: Sending "Partners" GraphQL request:
  query FindApp($apiKey: String!) {
    app(apiKey: $apiKey) {
      id
      title
      apiKey
      organizationId
      apiSecretKeys {
        secret
      }
      appType
      grantedScopes
      betas {
        unifiedAppDeployment
        unifiedAppDeploymentOptIn
      }
      applicationUrl
      redirectUrlWhitelist
      requestedAccessScopes
      webhookApiVersion
      embedded
      posEmbedded
      preferencesUrl
      gdprWebhooks {
        customerDeletionUrl
        customerDataRequestUrl
        shopDeletionUrl
      }
      appProxy {
        subPath
        subPathPrefix
        url
      }
    }
  }

With variables:
{
  "apiKey": "***"
}

With request headers:
 - User-Agent: Shopify CLI; v=3.48.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: linux
 - Content-Type: application/json

2023-07-31T09:32:48.275Z: Request to https://partners.shopify.com/api/cli/graphql completed in 980 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"2132e77d3f3a42c88a967c7899b5ed1e"
 - x-request-id: 7a7c79ae-1df3-458b-a55b-bbdd0d01a4b6
    
2023-07-31T09:32:48.275Z: Sending "Partners" GraphQL request:
  query FindOrganization($id: ID!) {
    organizations(id: $id, first: 1) {
      nodes {
        id
        businessName
        website
      }
    }
  }

With variables:
{
  "id": "116440"
}

With request headers:
 - User-Agent: Shopify CLI; v=3.48.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: linux
 - Content-Type: application/json

2023-07-31T09:32:48.525Z: Request to https://partners.shopify.com/api/cli/graphql completed in 246 ms
With response headers:
 - cache-control: max-age=0, private, must-revalidate
 - content-type: application/json; charset=utf-8
 - etag: W/"d984c4fd2e64e933dc657c6f3ef428c1"
 - x-request-id: 43467434-f68b-4b70-91eb-ef4cab66db62
    
╭─ 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  │
│      is loading this organization [2]                                        │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯
[1] https://partners.shopify.com/signup
[2] https://partner.shopify.com/116440

2023-07-31T09:32:48.608Z: Obtaining the dependency manager in directory /home/runner/work/ci/ci...
2023-07-31T09:32:48.622Z: 
Running system process:
  · Command: ruby -v
  · Working directory: /home/runner/work/ci/ci

2023-07-31T09:32:48.629Z: Obtaining the dependency manager in directory /home/runner/work/ci/ci...
2023-07-31T09:32:48.651Z: 
Running system process:
  · Command: ruby -v
  · Working directory: /home/runner/work/ci/ci

2023-07-31T09:32:48.816Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 138 ms
With response headers:
 - x-request-id: 22bc6a18-08bb-4105-b515-09495cfb58be
    
2023-07-31T09:32:48.819Z: Analytics event sent: {
  "command": "app deploy",
  "time_start": 1690795966881,
  "time_end": 1690795968627,
  "total_time": 1746,
  "success": true,
  "cli_version": "3.48.0",
  "ruby_version": "3.0.2",
  "node_version": "18.17.0",
  "is_employee": false,
  "uname": "linux amd64",
  "env_ci": true,
  "env_ci_platform": "github",
  "env_plugin_installed_any_custom": false,
  "env_plugin_installed_shopify": "[\"@shopify/app\",\"@shopify/cli\",\"@shopify/plugin-cloudflare\",\"@shopify/plugin-did-you-mean\"]",
  "env_shell": "bash",
  "env_device_id": "55e81496e073a0f4b31c2cdc4cfd281afeac4857",
  "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,
  "project_type": "node",
  "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": "01aa46074612a14e99144db22d6c0fe70f61f8d3",
  "app_path_hash": "3d1d98f2b4d09b6866bb21d532e9d616e2fd7295",
  "app_scopes": "[\"write_products\"]",
  "app_web_backend_any": true,
  "app_web_backend_count": 1,
  "app_web_custom_layout": true,
  "app_web_framework": "remix",
  "app_web_frontend_any": true,
  "app_web_frontend_count": 1,
  "env_package_manager_workspaces": true,
  "cmd_app_all_configs_any": true,
  "cmd_app_all_configs_clients": "{\"shopify.app.toml\":\"***\"}",
  "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": "default",
  "cmd_app_linked_config_uses_cli_managed_urls": true,
  "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": "3d1d98f2b4d09b6866bb21d532e9d616e2fd7295",
  "cmd_app_reset_used": false,
  "args": "-f --verbose",
  "app_name": "ci-ui-extensions",
  "env_plugin_installed_all": "[\"@shopify/app\",\"@shopify/cli\",\"@shopify/plugin-cloudflare\",\"@shopify/plugin-did-you-mean\"]",
  "metadata": "{\"extraPublic\":{},\"extraSensitive\":{}}"
}
2023-07-31T09:32:48.820Z: Completed command app deploy
2023-07-31T09:32:48.824Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 150 ms
With response headers:
 - x-request-id: abe53697-4716-46e7-9bab-ec057976e8af
    
2023-07-31T09:32:48.825Z: Analytics event sent: {
  "command": "app deploy",
  "time_start": 1690795966881,
  "time_end": 1690795968598,
  "total_time": 1717,
  "success": false,
  "cli_version": "3.48.0",
  "ruby_version": "3.0.2",
  "node_version": "18.17.0",
  "is_employee": false,
  "uname": "linux amd64",
  "env_ci": true,
  "env_ci_platform": "github",
  "env_plugin_installed_any_custom": false,
  "env_plugin_installed_shopify": "[\"@shopify/app\",\"@shopify/cli\",\"@shopify/plugin-cloudflare\",\"@shopify/plugin-did-you-mean\"]",
  "env_shell": "bash",
  "env_device_id": "55e81496e073a0f4b31c2cdc4cfd281afeac4857",
  "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,
  "project_type": "node",
  "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": "01aa46074612a14e99144db22d6c0fe70f61f8d3",
  "app_path_hash": "3d1d98f2b4d09b6866bb21d532e9d616e2fd7295",
  "app_scopes": "[\"write_products\"]",
  "app_web_backend_any": true,
  "app_web_backend_count": 1,
  "app_web_custom_layout": true,
  "app_web_framework": "remix",
  "app_web_frontend_any": true,
  "app_web_frontend_count": 1,
  "env_package_manager_workspaces": true,
  "cmd_app_all_configs_any": true,
  "cmd_app_all_configs_clients": "{\"shopify.app.toml\":\"***\"}",
  "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": "default",
  "cmd_app_linked_config_uses_cli_managed_urls": true,
  "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": "3d1d98f2b4d09b6866bb21d532e9d616e2fd7295",
  "cmd_app_reset_used": false,
  "args": "-f --verbose",
  "error_message": "No Organization found",
  "app_name": "ci-ui-extensions",
  "env_plugin_installed_all": "[\"@shopify/app\",\"@shopify/cli\",\"@shopify/plugin-cloudflare\",\"@shopify/plugin-did-you-mean\"]",
  "metadata": "{\"extraPublic\":{},\"extraSensitive\":{}}"
}
Error: Process completed with exit code 1.

Reproduction steps

  1. Go through https://shopify.dev/docs/apps/tools/cli/ci-cd#step-3-integrate-shopify-cli-into-your-pipeline and the demo code also gives the same error

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”

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (7 by maintainers)

Most upvoted comments

yeah looks like a few sites are down in Asia ATM. I’ll give it another try tomorrow morning. Thanks!

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.

@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. CleanShot 2023-08-01 at 16 17 12@2x

For now, I have generated a token with “UI Extension” access and “Functions” access.