0
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?

More than 3 years have passed since last update.

【AWS x Github】エラー「Either the GitHub repository "xxx" does not exist」の原因とは?

0
Posted at

概要

AWS CodepipelineでGithubの指定リポジトリの指定ブランチにマージがあった場合に、自動で実行される設定にしていたものが、突然「Either the GitHub repository "xxx" does not exist」のエラーで失敗してしまいました。

エラー概要

エラー全文は以下の通りです。
Codepipelineでは、OAuth承認でGithub Webhookを連携させています。
(バージョン1は古いので推奨されていません...バージョン2にしないとですが)

Either the GitHub repository "xxx" does not exist, or the GitHub access token provided has insufficient permissions to access the repository. Verify that the repository exists and edit the pipeline to reconnect the action to GitHub.

原因

原因は、最近オーナーアカウントのメールアドレスを変更したことでした。
オーナーアカウントのメールアドレスを変更した場合、GitHubはアクセス権限に影響を及ぼす変更があったとみなし、既存のアクセストークンを無効にしてしまうことがあるようです。

解決策

以前のアクセストークンが無効になってしまったので、再度認証を行って新しいアクセストークンを取得する必要があります。
OAuth承認をもう一度実施するには、Pipelineの画面から「Githubに接続する」をもう一度実行してあげれば良いです。以下の「OAuth リクエストを処理しています」という画面に飛ぶので、「確認」をクリックすると無事にパイプラインが走りました。

image.png

OAuthとは?

OAuth(オーオース)は、Webサービスやアプリケーションに対して、ユーザーの認証と権限委任を行うためのオープンスタンダードな認証プロトコルです。

これにより、AWS CodePipelineがGitHubリポジトリにアクセスし、ソースコードを取得したりアクションをトリガーしたりする際に、ユーザーのGitHubの認証情報を直接提供せずに済むようになります。

利用する場合は、GitHubのOAuthトークンというアクセストークン(CodePipelineがGitHub APIにアクセスするために必要な認証情報)が必要です。AWS CloudFormationを使用して設定することが多いと思いますが、その際はSecretManagerから取得するなどした方が良いでしょう。

0
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
0
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?