Creating a plan in Bamboo fails with Could not check if existing access key is valid: An error occurred while processing the request
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
When creating a new plan in Bamboo and selecting Bitbucket Server as the source repository it fails with below error:
"Could not check if existing access key is valid: An error occurred while processing the request. Check the server logs for more information."
The following appears in Bitbucket Server's atlassian-bitbucket.log
2017-09-08 07:34:16,376 ERROR [http-nio-7990-exec-68] @1WEI6YBx454x4378x0 172.19.0.4 "POST /rest/ssh/1.0/keys HTTP/1.1" c.a.s.i.r.e.DefaultUnhandledExceptionMapperHelper Unhandled exception while processing REST request: "POST /rest/ssh/1.0/keys HTTP/1.1"
java.lang.NullPointerException: username
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:226)
at com.atlassian.bitbucket.user.NoSuchUserException.<init>(NoSuchUserException.java:20)
at com.atlassian.bitbucket.internal.ssh.rest.SshKeysResource.getUser(SshKeysResource.java:207)
at com.atlassian.bitbucket.internal.ssh.rest.SshKeysResource.addSshKey(SshKeysResource.java:131)
Diagnosis
Environment
- Bitbucket Server is running behind reverse-proxy such as Nginx
Cause
The reverse proxy is forcing the HTTP Header for Authorization
to an empty value, e.g. ""
proxy_set_header Authorization "";
Resolution
Remove the Nginx configuration that sets the Authorization header for any proxied requests to " "