Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with bitbucket authentication #2437

Open
danmcnulty opened this issue Aug 10, 2022 · 1 comment
Open

Issue with bitbucket authentication #2437

danmcnulty opened this issue Aug 10, 2022 · 1 comment
Labels
provider/bitbucket question Further information is requested Stale

Comments

@danmcnulty
Copy link

Hi,
I'm trying to setup Atlantis and integrate it with Bitbucket.... so far I created a webhook in our Bitbucket repo to call out to our atlantis server /events URL and set it to trigger on pullrequest:created and pullrequest:updated - and when I update a PR I see successful (HTTP 200) requests logged.

However, in the Atlantis logs I see errors like this:

{
    "level": "error",
    "ts": "2022-08-10T16:21:58.472Z",
    "caller": "events/instrumented_project_command_builder.go:48",
    "msg": "Error building auto plan commands: making request \"GET https://api.bitbucket.org/2.0/repositories/companyname/reponame/pullrequests/66/diffstat\" unexpected status code: 401, body: Bitbucket Cloud recently stopped supporting account passwords for API authentication.\nSee our community post for more details: https://atlassian.community/t5/x/x/ba-p/1948231\nApp passwords are recommended for most use cases and can be created in your Personal settings:\nhttps://bitbucket.org/account/settings/app-passwords/\nFor more details on API authentication methods see our documentation:\nhttps://developer.atlassian.com/cloud/bitbucket/rest/intro/#authentication\n",
    "json": {},
    "stacktrace": "github.com/runatlantis/atlantis/server/events.(*InstrumentedProjectCommandBuilder).BuildAutoplanCommands\n\tgithub.com/runatlantis/atlantis/server/events/instrumented_project_command_builder.go:48\ngithub.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).runAutoplan\n\tgithub.com/runatlantis/atlantis/server/events/plan_command_runner.go:73\ngithub.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).Run\n\tgithub.com/runatlantis/atlantis/server/events/plan_command_runner.go:222\ngithub.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunAutoplanCommand\n\tgithub.com/runatlantis/atlantis/server/events/command_runner.go:173"
}

This is despite the fact that I am using an app password to authenticate and the same credentials work fine using curl eg:

curl -X GET -u "username:app-password" "https://api.bitbucket.org/2.0/repositories/companyname/reponame/pullrequests/66"

Any help would be appreciated.
Thanks

@jamengual jamengual added the question Further information is requested label Aug 26, 2022
@zer0beat
Copy link
Contributor

Hi! I get the same error. To solve it, you must use your username and not the email as a Bitbucket user.

To find your username:

  1. Select Avatar > Personal settings.
  2. Under Bitbucket profile settings > Username

I hope this helps you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
provider/bitbucket question Further information is requested Stale
Projects
None yet
Development

No branches or pull requests

4 participants