2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PR: JISOU | Reactプログラミングコーチング
AIで不安を感じたら!    JISOUメンバー募集中

「⨯ Next.js build worker exited with code: 1 and signal: null」の解決方法【Vercel/Deploy/CICD】

2
Posted at

はじめに

GitHub Actionsを使ってNext.jsをVercelにデプロイしようとしたらエラーが出た。

問題

GitHub Actionsでエラーが発生した部分

      - name: Deploy to Vercel
        run: npx vercel --prod --token ${{ secrets.VERCEL_TOKEN }} --yes
        env:
          orgId: ${{ secrets.VERCEL_TEAM_ID }}
          projectId: ${{ secrets.VERCEL_PROJECT_ID }}
          NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
          NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY: ${{ secrets.SUPABASE_PUBLISHABLE_KEY }}

解決方法

      - name: Deploy to Vercel
        run: |
          npx vercel --prod \
          --token ${{ secrets.VERCEL_TOKEN }} \
          --yes \
          --build-env NEXT_PUBLIC_SUPABASE_URL=${{ secrets.SUPABASE_URL }} \
          --build-env NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=${{ secrets.SUPABASE_PUBLISHABLE_KEY }}
        env:
          orgId: ${{ secrets.VERCEL_TEAM_ID }}
          projectId: ${{ secrets.VERCEL_PROJECT_ID }}

Supabaseの環境変数の渡し方を変えたらデプロイが成功しました。

参考文献

おわりに

npx vercel --prod --token ${{ secrets.VERCEL_TOKEN }} --yesではnpm run buildも実行されるのですが、そこで失敗していました。
ただ、デプロイではなくnpm run build単体のrunは最初の環境変数の渡し方で通っていたので不思議です。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?