BLOG

Node.js v20 で GitHubActions から Vercel へのデプロイがコケた話

# Node.js# Vercel# GitHub Actions
Node.js v20 で GitHubActions から Vercel へのデプロイがコケた話

結論

amondnet/vercel-actionvercel-version33.6.1 以降で指定しろ

# GitHubActions の Deploy workflow file の中
uses: amondnet/vercel-action@v25
with:
  vercel-version: latest # ←これ

環境

  • Next.js: v13
  • Node.js: v20
  • GitHubActions: amondnet/vercel-action@v25
  • Vercel Project Settings > Node.js Version: 18.x

解説

現象自体は Deployment doesn't respect choice of node v20 based on engines.node and errors out · Issue #10850 · vercel/vercel の ISSUE と同じ

Deployment doesn't respect choice of node v20 based on engines.node and errors out · Issue #10850 · vercel/vercel

The good news is that we finally found a solution and with the latest CLI 33.6.1 release this should no longer be a problem. We also updated our documentation on that: Version overrides in package.json

このコメントの通り、どうやら CLI の問題で 33.6.1 で修正されている。
最新の CLI を利用しているのであれば、Version overrides in package.json のドキュメントの通りの挙動で問題ない。

だた、GitHubActions から Vercel にデプロイするための Action である amondnet/vercel-action は内部でこの Vercel CLI を利用している。
この Action で利用する Vercel CLI の Version は inputs から渡して指定する形式のため、古いバージョンの可能性がある。

自分は見事に Action の CLI が古いバージョンだったため、ドキュメントと違う挙動をとっていてやられた 🥺

SHARE

新着記事