Skip to content
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]: Hydrogen CLI Deploy Deployment Tokens Not Supported #2515

Open
2 tasks done
lembn opened this issue Sep 10, 2024 · 4 comments
Open
2 tasks done

[Bug]: Hydrogen CLI Deploy Deployment Tokens Not Supported #2515

lembn opened this issue Sep 10, 2024 · 4 comments

Comments

@lembn
Copy link

lembn commented Sep 10, 2024

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?

Hydrogen custom storefront

Expected behavior

I expected the command shopify hydrogen deploy to deploy my branch to Oxygen when running the command with the SHOPIFY_HYDROGEN_DEPLOYMENT_TOKEN environment variable presented and populated without needing any user interaction.

Actual behavior

Even when providing a deployment token, the CLI prompts the user to log in to their Shopify account both from my local machine and my deployment CI in Gihub Actions, which is making my deployment CI fail. I tried instead to provide the token using the -t option but was given the error "Nonexistent flag: -t". The same happened with the long-form version of the option.

Verbose output

2024-09-10T00:42:33.048Z: Obtaining the dependency manager in directory ***...
2024-09-10T00:42:33.051Z:
Running system process:
· Command: ruby -v
· Working directory: ***

2024-09-10T00:42:33.055Z: Obtaining the dependency manager in directory ***...
2024-09-10T00:42:33.056Z:
Running system process:
· Command: ruby -v
· Working directory: ***

2024-09-10T00:42:33.290Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 226 ms
With response headers:

  • x-request-id: 66e082ef-ba38-4fed-8d55-71057e1f21bd

2024-09-10T00:42:33.291Z: Analytics event sent: {
"command": "hydrogen deploy",
"time_start": 1725928953027,
"time_end": 1725928953042,
"total_time": 15,
"success": false,
"cli_version": "3.49.2",
"ruby_version": "2.6.10",
"node_version": "22.8.0",
"is_employee": false,
"uname": "darwin arm64",
"env_ci": false,
"env_plugin_installed_any_custom": false,
"env_plugin_installed_shopify": "["@shopify/cli","@shopify/cli-hydrogen","@shopify/plugin-did-you-mean"]",
"env_shell": "zsh",
"env_device_id": "87f2f3705d95aa1c5cfcdc33516e543d7399bffe",
"env_cloud": "localhost",
"env_package_manager": "npm",
"cmd_all_launcher": "npm",
"cmd_all_topic": "hydrogen",
"cmd_all_plugin": "@shopify/cli-hydrogen",
"args": "--token *** --verbose",
"error_message": "Nonexistent flags: --token, --verbose\nSee more help with --help",
"env_plugin_installed_all": "["@shopify/cli","@shopify/cli-hydrogen","@shopify/plugin-did-you-mean"]",
"metadata": "{"extraPublic":{},"extraSensitive":{}}"
}

Reproduction steps

Unfortunately, I cannot publicize my repository to provide a clone for reproduction but I'm simply running npx shopify hydrogen deploy. I have also tried installing the CLI with no change in result

Operating System

Mac OS Sonoma

Shopify CLI version (check your project's package.json if you're not sure)

3.66.1

Shell

zsh

Node version (run node -v if you're not sure)

v22.8.0

What language and version are you using in your application?

Node 22

@lembn
Copy link
Author

lembn commented Sep 10, 2024

Here is my GH Workflow:

name: Storefront 1000023762
on: [push]

permissions:
  contents: read
  deployments: write

jobs:
  deploy:
    name: Deploy to Oxygen
    timeout-minutes: 30
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup node.js
        uses: actions/setup-node@v4
        with:
          node-version: 'lts/*'
          check-latest: true

      - name: Cache node modules
        id: cache-npm
        uses: actions/cache@v4
        env:
          cache-name: cache-node-modules
        with:
          path: ~/.npm
          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-build-${{ env.cache-name }}-
            ${{ runner.os }}-build-
            ${{ runner.os }}-

      - name: Install dependencies
        run: npm ci

      - name: Build and Publish to Oxygen
        run: npx shopify hydrogen deploy
        env:
          SHOPIFY_HYDROGEN_DEPLOYMENT_TOKEN: ${{ secrets.SHOPIFY_HYDROGEN_DEPLOYMENT_TOKEN }}

@isaacroldan isaacroldan transferred this issue from Shopify/cli Sep 11, 2024
@isaacroldan
Copy link
Contributor

I transfered this issue to the Hydrogen repo from the CLI repo, as this is the correct place for it :)

@lembn
Copy link
Author

lembn commented Sep 13, 2024

Thanks!

@graygilmore
Copy link
Contributor

Hi @lembn! There might be some version mismatches happening here. Before going any further can you try the following in your package.json:

- "@shopify/cli": "3.49.2",
+ "@shopify/cli": "3.66.1", // update to the latest version
- "@shopify/cli-hydrogen": "<VERSION>", // remove this entirely

After updating shopify/cli and removing cli-hydrogen try running again. We should never prompt to login in a CI environment but it's expected to happen in local development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants