Hydrogen CLI Deploy Requiring Login with Deployment Token

Solved

Hydrogen CLI Deploy Requiring Login with Deployment Token

ewsellers
Visitor
2 1 1

Attempting to try to deploy hydrogen using Azure DevOps Pipelines. When I run the deploy command, both on the CI machine and my local machine, it attempts to login to Shopify.

 

The command I am running both on the CI and my local CLI...

 

npx shopify hydrogen deploy --token ************

The results of running the command...

To run this command, log in to Shopify.

 

According to the Deployment CI/CD Docs, it seems like this should be the only command that is needed. How can I deploy from a CI without logging into Shopify? Is it possible to do it with just the Oxygen deployment token?

 

Thanks!

Accepted Solution (1)

ewsellers
Visitor
2 1 1

This is an accepted solution.

So we actually figured it out. Turns out the deploy command checks if your in a continuous integration (CI) environment (like GitHub Actions) and if your not, it falls back to user login. It does this by looking at environment variables (specifically the "CI" variable) and Azure DevOps Pipelines is not one of the supported CIs nor does it set the "CI" variable. Thus, the deploy command is unable to recognize in ADO, it's inside a CI.

 

To fix this simply set the "CI" environment variable to something truthy.

 

- script: |
    npx shopify hydrogen deploy --token $(SHOPIFY_HYDROGEN_DEPLOYMENT_TOKEN)
  displayName: Build and Publish to Oxygen
  workingDirectory: click-and-collect-storefront
  env:
   CI: true

 

 

View solution in original post

Reply 1 (1)

ewsellers
Visitor
2 1 1

This is an accepted solution.

So we actually figured it out. Turns out the deploy command checks if your in a continuous integration (CI) environment (like GitHub Actions) and if your not, it falls back to user login. It does this by looking at environment variables (specifically the "CI" variable) and Azure DevOps Pipelines is not one of the supported CIs nor does it set the "CI" variable. Thus, the deploy command is unable to recognize in ADO, it's inside a CI.

 

To fix this simply set the "CI" environment variable to something truthy.

 

- script: |
    npx shopify hydrogen deploy --token $(SHOPIFY_HYDROGEN_DEPLOYMENT_TOKEN)
  displayName: Build and Publish to Oxygen
  workingDirectory: click-and-collect-storefront
  env:
   CI: true