Shopify / hydrogen

Hydrogen lets you build faster headless storefronts in less time, on Shopify.
https://hydrogen.shop
MIT License
1.16k stars 233 forks source link

[Bug]: Error github action during shopify hydrogen deployment #1945

Closed bitforcesrl closed 15 hours ago

bitforcesrl commented 3 weeks ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

Hydrogen custom storefront

Expected behavior

The actions should succeed

Actual behavior

After merging the pull request created from the shopify bot the github action step "Build and Publish to Oxygen" fails.

Verbose output

Run npx shopify hydrogen deploy --build-command "yarn build"
  npx shopify hydrogen deploy --build-command "yarn build"
  shell: /usr/bin/bash -e {0}
  env:
    SHOPIFY_HYDROGEN_DEPLOYMENT_TOKEN: ***

  ERROR Raw mode is not supported on the current process.stdin, which Ink uses
The above error occurred in the <SelectPrompt> component:

       as input stream by default.
    at SelectPrompt (file:///home/runner/work/tooa-app/tooa-app/node_modules/@shopify/cli-kit/dist/private/node/ui/components/SelectPrompt.js:12:25)
    at App (file:///home/runner/work/tooa-app/tooa-app/node_modules/ink/build/components/App.js:18:9)

React will try to recreate this component tree from scratch using the error boundary you provided, InternalApp.
       Read about how to prevent this error on
       https://github.com/vadimdemedes/ink/#israwmodesupported

 - Read about how to prevent this error on
   https://github.com/vadimdemedes/ink/#israwmodesupported
 - value (node_modules/ink/build/components/App.js:46:31)
 -  (node_modules/ink/build/hooks/use-input.js:34:9)
 -commitHookEffectLis (node_modules/react-reconciler/cjs/react-reconciler.devel
  Mount              opment.js:14778:26)
 -commitPassiveMountO (node_modules/react-reconciler/cjs/react-reconciler.devel
  Fiber              opment.js:16609:11)
 -commitPassiveMountEffect (node_modules/react-reconciler/cjs/react-reconciler.
  _complete               development.js:16569:9)
 -commitPassiveMountEffe (node_modules/react-reconciler/cjs/react-reconciler.de
  ts_begin              velopment.js:16556:7)
 -commitPassiveMountE (node_modules/react-reconciler/cjs/react-reconciler.devel
  fects              opment.js:16544:3)
 -flushPassiveEffect (node_modules/react-reconciler/cjs/react-reconciler.develo
  Impl              pment.js:19182:3)
 -flushPassiveEff (node_modules/react-reconciler/cjs/react-reconciler.developme
  cts            nt.js:19127:14)
 -performSyncWorkOn (node_modules/react-reconciler/cjs/react-reconciler.develop
  oot              ment.js:18184:3)

Reproduction steps

Run the github actions to deploy on oxygen

Operating System

github action

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

latest

Shell

No response

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

v20

What language and version are you using in your application?

No response

graygilmore commented 2 weeks ago

@bitforcesrl 👋🏻 can you confirm which version of cli-hydrogen you're trying to use? The deploy command was marked as stable in v7.

bitforcesrl commented 2 weeks ago

@graygilmore we are executing the following command via GitHub Actions: npx shopify hydrogen deploy --build-command "yarn build"

The GitHub Actions we are using are those generated automatically by Oxygen

# Don't change the line below!
#! oxygen_storefront_id: xxxx

name: Storefront xxxx
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: Get yarn cache directory
      id: yarn-cache-dir-path
      run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
    - uses: actions/cache@v4
      with:
        path: "${{ steps.yarn-cache-dir-path.outputs.dir }}"
        key: "${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}"
        restore-keys: "${{ runner.os }}-yarn-\n"
    - name: Install dependencies
      id: install-dependencies
      run: yarn
    - name: Build and Publish to Oxygen
      id: deploy
      run: npx shopify hydrogen deploy --build-command "yarn build"
      env:
        SHOPIFY_HYDROGEN_DEPLOYMENT_TOKEN: "${{ secrets.OXYGEN_DEPLOYMENT_TOKEN_688471 }}"
graygilmore commented 2 weeks ago

Thanks! Unfortunately that doesn't say what version of cli-hydrogen you are running. What does your package.json say for that dependency? And what is committed as the version to your lockfile?

bitforcesrl commented 1 week ago

We are using cli-hydrogen v4.0.3. I've updated the dependency to the latest version (v8) but now we have another problem, we need to update remix to v2 because the cli requires it. Is there a guide to migrate our code base from remix 1 to remix 2? Thank you

wizardlyhel commented 1 week ago

Hey @bitforcesrl, please follow this and turn on all the v2 future flags in your project https://github.com/Shopify/hydrogen/discussions/739

Since your project is quite behind, I wonder if it is better to just regenerate a new project and copy your existing project into the new project. Your project is most likely require a very strict dependency between all the Remix, Shopify package versions and if you bump any package's versions, the project might not even run. Since Hydrogen v2023.10.0, Remix becomes a peer dependency along with many other Remix and Shopify packages ... and trying to carefully upgrade your project through all of these changes would be challenging.

We introduced a h2 upgrade in 2023.10.0 cli command that should work retroactively if you can get your project to Hydrogen 2023.1.0. Maybe give this a try? but only run this command after you have turn on all v2 future flags.

blittle commented 1 week ago

Also check out Remix's guide here: https://remix.run/docs/en/main/start/v2

bitforcesrl commented 1 week ago

Thanks for the advice. The project it's quite big. It's deployed in a capacitor app on android and apple stores and it runs code to control a robot machine via bluetooth that makes ice cream. Plus in the app there are pages that show products that are on the shopify e-commerce. Migrating it to a new project structure will be challenging too. when the current git hub actions will be deprecated? https://www.tooa.com/en/products/macchina-gelato-bupt0000

graygilmore commented 1 week ago

when the current git hub actions will be deprecated?

No immediate plans to remove the action but important to note that it won't be receiving any new features. For example, end-to-end testing with authentication bypass tokens is only available through the updated cli-hydrogen package.

graygilmore commented 15 hours ago

Closing as this isn't a bug with the deploy command.