CLIENT_ERROR: Submodule error authorization failed

0

Getting this error while my code build project "DOWNLOAD SOURCE" from AWS CODE COMMIT source

CLIENT_ERROR: Submodule error authorization failed for primary source and source version

Note : I have created submodule in my repo, it points to another code commit repo

2 Answers
0

The error "CLIENT_ERROR: Submodule error authorization failed" typically occurs when your AWS CodeBuild project is trying to download a Git submodule that points to another AWS CodeCommit repository, but it doesn't have the proper permissions to access the submodule repository.

  1. Update IAM Role: Ensure that the IAM role used by CodeBuild has the necessary permissions to access both the primary and submodule repositories.
  2. Verify Submodule URL: Check the submodule URL in the .gitmodules file to ensure it points correctly to the CodeCommit repository.
  3. Consider SSH: If you face HTTPS issues, switch to SSH-based authentication for the submodules.
  4. Ensure Submodule Initialization: Make sure that submodules are being initialized correctly during the build process.
profile pictureAWS
EXPERT
Deeksha
answered 2 months ago
  • i tried the #3 point to switch from https to ssh in .gitmodules...now getting a different error.... CLIENT_ERROR: Submodule error error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"

0

Hello.

Try adding the following IAM policy to your CodeBuild IAM role.
This error could occur when CodeBuild did not have permission to pull from CodeCommit.
https://docs.aws.amazon.com/codecommit/latest/userguide/auth-and-access-control-permissions-reference.html#aa-git
https://docs.aws.amazon.com/codebuild/latest/userguide/setting-up-service-role.html

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "codecommit:GitPull"
            ],
            "Resource": "arn:aws:codecommit:region:account-id:repository-name",
            "Effect": "Allow"
        }
    ]
}
profile picture
EXPERT
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions