1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Vercel × GitHub Actions】An unexpected error occurred in pull: TypeError: Cannot read properties of undefined (reading 'value')の解決方法

Last updated at Posted at 2025-02-08

はじめに

VercelGitHub Actionsを使ってCI/CDを行っていた際に、デプロイ時にエラーが発生しました。今回はそのエラーの原因と解決方法についてまとめます。

この記事は個人的なアウトプットを目的として作成したものです。そのため、誤った情報や不足している内容が含まれている可能性があります。もし間違いや気になる点がございましたら、ぜひご指摘いただけますと幸いです

問題

GitHub Actionsの実行時に、以下のエラーが発生しました。

An unexpected error occurred in pull: TypeError: Cannot read properties of undefined (reading 'value')

スクリーンショット 2025-02-08 11.03.43.png

Vercelを利用してGitHub Actions経由でデプロイを行っている環境で、このエラーが発生しました。

解決方法

このエラーは、Vercelのアクセストークンの有効期限が切れていたことが原因でした。
Vercelのトークンには有効期限を設定できるため、一定期間が経過すると無効になり、GitHub ActionsからVercelへの認証が失敗してしまいます。

手順

  1. Vercelで新しいトークンを発行する
  • Vercelのダッシュボード にログイン
  • SettingsTokensに移動
  • Create Token」 をクリックして新しいトークンを作成
    トークンの有効期限を適切に設定し(例: 無期限 or 数か月)、「Create
  1. GitHub ActionsのSecretsを更新
  • GitHubのリポジトリにアクセス
  • SettingsSecrets and variablesActionsに移動
    +「New repository secret」 をクリック
  • NameVERCEL_TOKENにし、発行したトークンを入力して保存
  1. GitHub Actionsのワークフローを再実行
    トークンを更新後、再度GitHub Actionsのデプロイを実行すると、正常に動作することを確認できました。

終わりに

Vercelのアクセストークンは有効期限を設定できるため、期限切れによるデプロイエラーに注意が必要です。次回は長めの有効期限を設定しようと思いました。

参考

『Next.jsプロジェクトをGitHub ActionsでVercelに自動デプロイさせよう!』Qiita

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?