CI hydrogen env push pull

I have reproduced the issue on the latest CLI version.

Yes, I am on the latest version

I have searched existing posts and this report is not a duplicate.

Yes, this isn’t a duplicate

In which of these areas are you experiencing a problem?

Hydrogen custom storefront

Expected behavior

hydrogen env push should accept a token similar to the deploy command so it can be run in a CI environment. Maybe “hydrogen env pull” as well but I can see not wanting to potentially pull sensitive secrets with that command.

This is as a workaround for wanting to control some non-sensitive env vars in git which would actually be better supported by Deploy --env-file flag should merge with Oxygen dashboard variables instead of replacing them · Shopify/hydrogen · Discussion #3302 · GitHub

Actual behavior

hydrogen env push does not accept a token argument and is only available after interactive login in.

Reproduction steps

On my CI machine…

npx shopify hydrogen env push --env-file .env.qa --env preview
3s

  • npx shopify hydrogen env push --env-file .env.qa --env preview
    To run this command, log in to Shopify.
    ╭─ error ──────────────────────────────────────────────────────────────────────╮
    │ │
    │ Unable to authenticate with Shopify. Please report this issue. │
    │ │
    ╰──────────────────────────────────────────────────────────────────────────────╯

On CI machine with token:
npx shopify hydrogen env push --token $SHOPIFY_QA_HYDROGEN_DEPLOYMENT_TOKEN --env-file .env.qa --env preview
2s

  • npx shopify hydrogen env push --token $SHOPIFY_QA_HYDROGEN_DEPLOYMENT_TOKEN --env-file .env.qa --env preview
    ╭─ error ──────────────────────────────────────────────────────────────────────╮
    │ │
    │ Nonexistent flag: --token │
    │ See more help with --help │
    │ │
    ╰──────────────────────────────────────────────────────────────────────────────╯

Verbose output

npx shopify hydrogen env push --verbose --token $SHOPIFY_QA_HYDROGEN_DEPLOYMENT_TOKEN --env-file .env.qa --env preview
4s

  • npx shopify hydrogen env push --verbose --token $SHOPIFY_QA_HYDROGEN_DEPLOYMENT_TOKEN --env-file .env.qa --env preview
    2025-11-06T22:35:27.348Z: Checking if there’s a version of @shopify/cli newer than 3.80.7
    2025-11-06T22:35:27.350Z: Getting the latest version of NPM package: @shopify/cli
    2025-11-06T22:35:27.393Z: Running command hydrogen env push
    ╭─ error ──────────────────────────────────────────────────────────────────────╮
    │ │
    │ Nonexistent flags: --verbose, --token │
    │ See more help with --help │
    │ │
    ╰──────────────────────────────────────────────────────────────────────────────╯
    2025-11-06T22:35:27.499Z: Running system process:
    · Command: npm prefix
    · Working directory: /opt/atlassian/pipelines/agent/build
    2025-11-06T22:35:27.651Z: Obtaining the dependency manager in directory /opt/atlassian/pipelines/agent/build…
    2025-11-06T22:35:27.773Z: Getting session store…
    2025-11-06T22:35:27.776Z: Getting session store…
    2025-11-06T22:35:27.841Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 62 ms
    With response headers:
  • x-request-id: 25a732dd-50a4-40b1-9e54-7323a3c8976f

2025-11-06T22:35:27.843Z: Analytics event sent: {
“command”: “hydrogen env push”,
“time_start”: 1762468527393,
“time_end”: 1762468527487,
“total_time”: 94,
“success”: false,
“cli_version”: “3.80.7”,
“ruby_version”: “”,
“node_version”: “20.19.5”,
“is_employee”: false,
“uname”: “linux amd64”,
“env_ci”: true,
“env_ci_platform”: “bitbucket”,
“env_plugin_installed_any_custom”: false,
“env_plugin_installed_shopify”: “["@shopify/cli"]”,
“env_shell”: “bash”,
“env_device_id”: “cb2695f64919e416c85bf3642e255878e541f880”,
“env_cloud”: “localhost”,
“env_package_manager”: “npm”,
“env_is_global”: false,
“env_auth_method”: “none”,
“env_is_wsl”: false,
“cmd_app_warning_api_key_deprecation_displayed”: false,
“cmd_all_timing_network_ms”: 0,
“cmd_all_timing_prompts_ms”: 0,
“cmd_all_launcher”: “npm”,
“cmd_all_topic”: “hydrogen env”,
“cmd_all_plugin”: “@shopify/cli-hydrogen”,
“cmd_all_timing_active_ms”: 94,
“cmd_all_exit”: “expected_error”,
“user_id”: “unknown”,
“request_ids”: ,
“args”: “–verbose --token $SHOPIFY_QA_HYDROGEN_DEPLOYMENT_TOKEN --env-file .env.qa --env preview”,
“error_message”: “Nonexistent flags: --verbose, --token\nSee more help with --help”,
“env_plugin_installed_all”: “["@shopify/cli"]”,
“metadata”: “{"extraPublic":{},"extraSensitive":{}}”
}
2025-11-06T22:35:27.849Z: Reporting handled error to Bugsnag: Nonexistent flags: --verbose, --token
See more help with --help
2025-11-06T22:35:28.940Z: Running system process:
· Command: npm prefix
· Working directory: /opt/atlassian/pipelines/agent/build
2025-11-06T22:35:29.057Z: Obtaining the dependency manager in directory /opt/atlassian/pipelines/agent/build…
2025-11-06T22:35:29.057Z: Getting session store…

Operating system

Docker image: node:20

CLI version

3.85.5

An interesting idea! I think this would require a pretty big overhaul to token management so I agree that Deploy --env-file flag should merge with Oxygen dashboard variables instead of replacing them · Shopify/hydrogen · Discussion #3302 · GitHub would be the better alternative here. I’ll check in with the team and see if that’s something we’d like to start looking at but it wouldn’t be in the near future.

1 Like