Amplify-console: How can I change repository of the existing app?

Created on 3 Dec 2019  路  15Comments  路  Source: aws-amplify/amplify-console

* Please describe which feature you have a question about? *
We have an app connected to Bitbucket repo. We are migrating to GitHub private repo. If it possible to update a source repo of the existing app?

I've tried to update the app using aws cli

aws amplify update-app --app-id AMPLIFY_APP_ID --repository https://github.com/microapps/private-repo.git --access-token GITHUB_ACCESS_TOKEN

But I get this error:

Error parsing parameter '--repository': Unable to retrieve https://github.com/microapps/private-repo.git: received non 200 status code of 301
question

Most helpful comment

Seems odd that aws amplify update-app has a --repository argument available to it if we can't use it :(

All 15 comments

@jimmyn there's no way of changing the repo for an app. A workaround is to duplicate the app using aws amplify get-app and then use those settings to create an app using aws amplify create-app.

Seems odd that aws amplify update-app has a --repository argument available to it if we can't use it :(

This is kind of infuriating btw

Would be great if this were possible. Has caused a lot of issues with domain management 鈥斅燾onstantly having to recreate apps is not a good UX. Netlify does this better.

disappointing

@swaminator I'm not sure why this issue was closed and no explanation has been given on why it's impossible to support such seemingly simple functionality.

we can change it by using the Amplify Console UI.

  1. go to the Amplify console General page
    image

  2. click on Reconnect repository
    image

  3. It'll reload the page and show you the change/reconnect repository modal. (It's a little buggy and take some time to show the popup)
    image

  4. change the repository and It's done 馃挴

this doesn't allow you to change to a different git provider/account. is there a way to do that?

The AWS CLI command outlined above will change an Amplify app's source repository provider/account along with the URL:

aws amplify update-app --app-id AMPLIFY_APP_ID --repository REPOSITORY_URL --access-token ACCESS_TOKEN

Please keep in mind that the --access-token expectations are different for each of the providers as they handle authentication differently.

we can change it by using the Amplify Console UI.

  1. go to the Amplify console General page
    image
  2. click on Reconnect repository
    image
  3. It'll reload the page and show you the change/reconnect repository modal. (It's a little buggy and take some time to show the popup)
    image
  4. change the repository and It's done 100

Umm, nope, it is still showing the old one

aws amplify update-app --app-id AMPLIFY_APP_ID --repository REPOSITORY_URL --access-token ACCESS_TOKEN

... worked for me, transferring from one github account to another github account and repo. I know it's not quite what the OP was doing, but thought it may be worth noting that:

  • The AMPLIFY_APP_ID is the last bit of the app ARN (e.g. dXXXXXXXXXXXXX)
  • For github repositories, the access token is a Personal Access Token (https://github.com/settings/tokens).
  • I gave it all of the _repo_ and _admin:repo_hook_ privileges.
  • That had to be created from the repository owner's account, not a contributor.

Did anyone managed this with Bitbucket Cloud where you cannot generate access token? I tried to get a token when connecting another app but getting an error:

An error occurred (BadRequestException) when calling the UpdateApp operation: There was an issue setting up your repository. Please try again later.(Invalid Authorization header)

@MatteoInfi

Umm, nope, it is still showing the old one

You need to grant org access to OAuth Apps:
(Sorry for the ugly writing)

image
image

Also you might need to delete old webhooks from the repository.

Well i now did it a really easy way. You just need to delete all your frontend enviroments. Then you can change the Repo and add them again with the existing backend.

The current behavior is extremely buggy. I transferred my repository from my personal account to an organization, when I wanted to do this using the Amplify UI, the Reconnect repository button just kept spinning without allowing me to do any change.

I don't know what exactly did the trick but here's what I tried and end up working allowing me to modify the repository.

Remove any manual environment created on the Amplify UI
Make sure the Oauth Application has been granted access to your repo
Make sure the Access Token can read repos and also have webhook permissions
Try to run the update command line, at this point I was getting a diferent error "An error occurred (BadRequestException) when calling the UpdateApp operation: There was an issue setting up your repository. Please try again later."
I came back to the Amplify UI page and a this point I was able to reconfigure the repository again.

Was this page helpful?
0 / 5 - 0 ratings