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?]: initial deploy to Vercel not working with latest (rw 7.0.6, node 20) #10100

Closed
1 task
jason-curtis opened this issue Mar 2, 2024 · 12 comments
Closed
1 task
Labels
bug/needs-info More information is needed for reproduction topic/deployment

Comments

@jason-curtis
Copy link
Contributor

jason-curtis commented Mar 2, 2024

What's not working?

Initial deploy to Vercel fails. Error log: https://gist.github.com/jason-curtis/c922f9cf3b5520e9d2d418667555642b

Key section of the log appears to be:

[14:27:06.339] $ /vercel/path0/node_modules/.bin/rw data-migrate up
[14:27:07.038] Installing plugin "@redwoodjs/cli-data-migrate"...
[14:27:08.101] error Running this command will add the dependency to the workspace root rather than the workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check).
[14:27:08.101] info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
[14:27:08.116] Error: Command failed with exit code 1: yarn add -D @redwoodjs/[email protected]

How do we reproduce the bug?

  • Create a new redwood project w/ yarn create redwood-app whatever
  • push it to a github repo
  • Start a new deploy from that project on Vercel
    • it will fail the first time until you go into project settings and set node version to 20 (expected, I guess?)
  • Start a redeploy
  • deploy fails with the error above.

What's your environment? (If it applies)

(this info may not be relevant since the error is happening on vercel but I ran `yarn rw info` locally)

  System:
    OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.11.1 - /tmp/xfs-40a4659e/node
    Yarn: 4.1.0 - /tmp/xfs-40a4659e/yarn
  Browsers:
    Chrome: 121.0.6167.139
  npmPackages:
    @redwoodjs/core: 7.0.6 => 7.0.6 
    @redwoodjs/project-config: 7.0.6 => 7.0.6

Are you interested in working on this?

  • I'm interested in working on this
@jason-curtis jason-curtis added the bug/needs-info More information is needed for reproduction label Mar 2, 2024
@jason-curtis
Copy link
Contributor Author

jason-curtis commented Mar 3, 2024

Interestingly, if I deploy manually using a Github Action with these steps it works fine:

      - name: Install Vercel CLI
        run: npm install --global vercel@canary
      - name: Pull Vercel Environment Information
        run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
      - name: Build Project Artifacts
        run: vercel build --token=${{ secrets.VERCEL_TOKEN }} --prod
      - name: Deploy Project Artifacts to Vercel
        run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} --prod

But if I use this pre-built GH action, I get the Running this command will add the dependency to the workspace root error:


      - name: Deploy to Vercel
        uses: amondnet/vercel-action@v20
        with:
          vercel-token: ${{ secrets.VERCEL_TOKEN }}
          github-comment: true
          github-token: ${{ secrets.GITHUB_TOKEN }}
          # Include a --prod flag for Vercel CLI, but leave empty for preview deploys
          vercel-args: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && '--prod' || '' }}
          vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
          vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}

I'm not sure if that helps figure out the root cause, but at least there's a workaround that seems to do the trick.

@Tobbe
Copy link
Member

Tobbe commented Mar 3, 2024

Thanks for providing a workaround @jason-curtis

I'll have someone on the team take a look at this issue that's more familiar with both data-migrate and Vercel deploys than I am. They, or I, will get back to you as soon as we've had a chance to investigate.

@jtoar
Copy link
Contributor

jtoar commented Mar 5, 2024

Hey @jason-curtis I can reproduce and I'm pretty sure I know what's at play. Will circle back once I confirm.

@jtoar
Copy link
Contributor

jtoar commented Mar 5, 2024

@jason-curtis I think you have to enable Corepack in Vercel's build container via ENABLE_EXPERIMENTAL_COREPACK=1:

image

https://vercel.com/docs/deployments/configure-a-build#corepack

I should update the setup command to call this out.

@jason-curtis
Copy link
Contributor Author

jason-curtis commented Mar 10, 2024

Ahh, I see. I've had to enable corepack in other cases as well- eg. when running tests or lint in CI, my GH actions steps look something like this:

    steps:
      - uses: actions/checkout@v2
      - name: Enable corepack, which makes yarn work (https://yarnpkg.com/corepack)
        run: corepack enable
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'yarn'
      - name: Install Dependencies
        run: yarn install
      - name: Run Tests (API side)
        run: yarn rw test api --no-watch

There might be some other docs we could update to clarify that corepack needs to be enabled.

@ahaywood
Copy link
Contributor

ahaywood commented Mar 11, 2024

I should update the setup command to call this out.

@jtoar Are you working on updating the set up command?

🙋‍♀️ Otherwise, I'm happy to update the docs.

@jason-curtis
Copy link
Contributor Author

Note there's an open issue and PR upstream for a more straightforward/robust way to enable corepack: actions/setup-node#531

@jtoar
Copy link
Contributor

jtoar commented Mar 12, 2024

@ahaywood not working on this go for it

@rafavalerio

This comment was marked as resolved.

@thedavidprice
Copy link
Contributor

@rafavalerio just to make sure, when you run yarn on your project locally, are there any changes to your yarn.lock that need to be checked in to git? If not, we'll need to dig a bit deeper here.

@rafavalerio
Copy link

@rafavalerio just to make sure, when you run yarn on your project locally, are there any changes to your yarn.lock that need to be checked in to git? If not, we'll need to dig a bit deeper here.

Hi @thedavidprice, the reason was locally I was using Yarn 1.x and having Yarn 4.x on Vercel! All solved now!

@thedavidprice
Copy link
Contributor

fixed by #10355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/needs-info More information is needed for reproduction topic/deployment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants