Skip to content

[Bug]: AWS Amplify doesn't seem to support GitHub App tokens #36071

Description

@AlissonRS

Terraform Core Version

1.7.3

AWS Provider Version

5.39.1

Affected Resource(s)

The affected resource is: module.amplify.aws_amplify_app

Expected Behavior

I'm trying to setup Amplify connecting to my private GitHub repo. Since all infra is provisioned by pipelines, I wanted to avoid using a dev's personal access token, it should be able to provision using a GitHub App token instead.

Actual Behavior

It seems like when I provide a token from GitHub App, it fails with this error:

│ Error: creating Amplify App (MyApp): BadRequestException: There was an issue setting up your repository. Please try again later.({"message":"Not Found","documentation_url":"https://docs.github.com/rest/repos/webhooks#create-a-repository-webhook"})

The GitHub App has write permissions on Webhooks for all repositories in the org (including the one I'm trying to set up). So it's unclear why this is not working, either I'm still missing something or this module doesn't support GitHub App tokens.

Relevant Error/Panic Output Snippet

> │ Error: creating Amplify App (MyApp): BadRequestException: There was an issue setting up your repository. Please try again later.({"message":"Not Found","documentation_url":"https://docs.github.com/rest/repos/webhooks#create-a-repository-webhook"})

Terraform Configuration Files

We can use the example from terraform docs, but providing a GitHub App token:

resource "aws_amplify_app" "example" {
  name       = "example"
  repository = "https://github.com/example/app"

  # GitHub personal access token
  access_token = "..." # GitHub App token

  # The default build_spec added by the Amplify Console for React.
  build_spec = <<-EOT
    version: 0.1
    frontend:
      phases:
        preBuild:
          commands:
            - yarn install
        build:
          commands:
            - yarn run build
      artifacts:
        baseDirectory: build
        files:
          - '**/*'
      cache:
        paths:
          - node_modules/**/*
  EOT

  # The default rewrites and redirects added by the Amplify Console.
  custom_rule {
    source = "/<*>"
    status = "404"
    target = "/index.html"
  }

  environment_variables = {
    ENV = "test"
  }
}

Steps to Reproduce

  1. Generate a token using a GitHub App that has write permissions on the repository you are trying to connect to Amplify.
  2. Provide this token in the terraform setup for the Amplify module.
  3. Try to apply the changes using this token in the access_token field from the aws_amplify_app resource.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAddresses a defect in current functionality.service/amplifyIssues and PRs that pertain to the amplify service.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions