aws-amplify / aws-amplify/amplify-hosting

How do I use update-app to switch to Bitbucket Cloud git Service provider from Code Commit?

Open
#3,290 3 comments 0 reactions 0 assignees View on GitHub
bug git-providers pending-prioritization
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Before opening, please confirm:

- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-hosting/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting questions](https://github.com/aws-amplify/amplify-hosting/blob/master/CONTRIBUTING.md).
- [X] I have removed any sensitive information from my code snippets and submission.

### App Id

d3099d9n2yrh6h

### AWS Region

us-west-2

### Amplify Hosting feature

Git providers

### Question

Please refer to this previous question for context:
https://github.com/aws-amplify/amplify-hosting/issues/288

A couple of issues I see with Amplify and the update-app API call mentioned there:

1.-Neither the AWS CLI, nor the AWS raw API Documentation clarify how the repository URL should be specified. It would be great if there were examples for each.
2.-When making the call to the update-app endpoint via AWS CLI 2 I'm getting an error from Bitbucket oauth pathways even though I've followed their instruction.

Reference documents:
AWS CLI: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/amplify/update-app.html
AWS API: https://docs.aws.amazon.com/amplify/latest/APIReference/API_UpdateApp.html#amplify-UpdateApp-request-oauthToken

Bitbucket Repository Access Tokens, keep in mind this could be also a project or workspace token, the result is identical:
https://support.atlassian.com/bitbucket-cloud/docs/repository-access-tokens/
https://support.atlassian.com/bitbucket-cloud/docs/using-access-tokens/
https://support.atlassian.com/bitbucket-cloud/docs/create-a-repository-access-token/

AWS prescriptive guide, where the oath system and the level of access required is mentioned as an example:
https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/integrate-a-bitbucket-repository-with-aws-amplify-using-aws-cloudformation.html

Here are the calls I tried with CLI:

`aws amplify --region us-west-2 --profile AWS_SSO_Profile update-app --app-id ${app-id} --repository $repo_url --oauth-token $Bitbucket_Repository_token `

Where:
$repo_url:

- git@bitbucket.org:workspace/repo_name.git
- https://bitbucket.org/workspace/repo_namel.git

and
$Bitbucket_Repository_token: Oath token returned by Bitbucket cloud when creating an access token as per this guide with FULL admin permissions for testing: https://support.atlassian.com/bitbucket-cloud/docs/create-a-repository-access-token/

On both cases I'm getting the following response:

`An error occurred (BadRequestException) when calling the UpdateApp operation: There was an issue setting up your repository. Please try again later.({"type": "error", "error": {"message": "This API is not accessible by this authentication mechanism"}})`

I definitely have access to the AWS API using SSO as the same method/api call returns the same error simply using Access keys.

Also, the Bitbucket cloud side definitely registers that the Access token has been invoked.

lastly, using a token at a higher hierarchy level, for example the bitbucket project rather than the repository makes no difference at all.

Thank you in advance and hope to hear from you soon.

Operations/Business case:
We would much prefer to have the option to utilize bitbucket access tokens rather than the normal workflow where a bitbucket user has to sign in and provide admin access to the repo. This avoids two problems:
1.-Having to use a shared service account that might access multiple repos in the git service provider.
2.-Using a personal bitbucket account.

Also consider that as discussed in the referenced question thread, there's no UI for switching git service providers.

So long term, if this gets answered and it works I would like to continue to requesting two features(obviously on a separate ticket) but leaving here as feedback:
1.-Provide a UI with functionality to switch
2.-Clear documentation with EXAMPLES on how to use tokens for each of the supported Git Service providers(Github,Bitbucket,Gitlab, Code Commit) rather than a generic message.

Thanks!

Contributor guide

Open the contributing guide

Research direction

Start with FAQ.md, the AWS CLI update-app reference, and the API reference linked in the issue; compare them with the previous issue #288 and the cited Bitbucket and AWS prescriptive guides. Establish the supported repository URL and token expectations, then document provider-specific examples and the observed failure conditions.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, git
Domain
ci-cd, cloud
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.