question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[aws-amplify] Can't connect to GitHub

See original GitHub issue

❓ General Issue

The Question

I’m trying to add an Amplify app via CDK but can’t connect to GitHub with my Personal Access Token (repo scope).

const amplifyApp = new amplify.App(this, 'App', {
  sourceCodeProvider: new amplify.GitHubSourceCodeProvider({
    owner: 'x',
    repository: 'y',
    oauthToken: cdk.SecretValue.plainText(process.env.PAT as string)
  }),
});
2:27:59 PM | CREATE_FAILED        | AWS::Amplify::App        | LandingF95672E9
There was an issue setting up your repository. Please try again later.({"message":"Not Found","documentation_url":"https://docs.github.com/rest/reference/repos#create-a-repository-webhook"
}) (Service: Amplify; Status Code: 400; Error Code: BadRequestException; Request ID: -)

I assume this is an access issue? However the access seems right to me. Am I using the plain text secret correctly? I also tried non-plain text but ran into different issues. For now, I’d just like to get it working as simple as possible.

Environment

  • CDK CLI Version: 6.14.6
  • Module Version:
  • Node.js Version: v14.6.0
  • OS: WSL2
  • Language (Version): TS

Other information

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
a-hcommented, Aug 13, 2021

I had this problem, and the underlying problem was that the user that created the Personal Access Token must also (for some reason) be an Admin of the repository: https://github.com/aws-amplify/amplify-console/issues/2160

1reaction
ryanjdilloncommented, Oct 12, 2021

My issues was storing the GitHub PAT as a key/value pair in AWS Secrets manager, which then requires that you pass the json option to the SecretManager. I rather saved it as a Plaintext secret, and that did the job.

This is what helped me: https://github.com/aws/aws-cdk/issues/3515#issuecomment-517844714

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to connect repository to existing amplify app #1554
Create a new GitHub Repository; Clone it via GitHub Explorer; Start Visual Studio Code and open newly cloned Folder; Install Amplify CLI ...
Read more >
Unable to connect to Github · Issue #2733 · aws-amplify ...
In deploying a new Nextjs application, I am unable to get Amplify to connect to Github. The amplify deployment is done with CDK...
Read more >
Can't connect Github Repo · Issue #564
I have a react website up and running by using the Amplify CLI and I am able to deploy successfully by doing an...
Read more >
I can't "Connect branch" · Issue #2731 · aws-amplify ... - GitHub
I go to "Connect branch" and it says "GitHub authorization was successful." but when I click Next I got "Please select a repository...
Read more >
Amplify can't connect to gitlab ( previously it worked ) #2635
We are trying to connect amplify to gitlab, this started to occurs in the last two days. We can't anymore connect on gitlab...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found