Unable to get a valid response from Github while adding an Linked repository
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
Summary
While trying to add a GitHub Enterprise when creating the Linked repository, a "The Server returned invalid response(not a JSON object)" error is seen in Bamboo UI.
Environment
Observed on Bamboo 8.1.8, but might be applicable for any other supported versions.
Diagnosis
A simple cURL
or Telnet
command can help to cross-check the availability of network connection between the Bamboo server and the GitHub instance.
The test can be performed using the commands below. In the examples given below, both Successful and Unsuccessful results are given.
Unsuccessful outcome of the commands looks like below,
$ curl -i https://<Github URL>
curl: (6) Could not resolve host: github.com
OR
$ telnet <Github URL> <Port>
Trying 140.82.114.4...
Successful outcome of the commands looks like below,
telnet <Github URL> <Port>
Successful Result:
Trying 140.82.114.4...
Connected to github.com.
Escape character is '^]'.
OR
curl -i https://<Github URL>
Successful Result:
HTTP/2 200
server: GitHub.com
date: Tue, 08 Nov 2022 22:59:30 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Language, Accept-Encoding, Accept, X-Requested-With
content-language: en-US
etag: W/"2361a59243f4de7629d4ca75313b86b9"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
Cause
There are two possible causes:
- Bamboo server might be in a Secure network (secure zone) and GitHub is not part of that same secure zone. Usually, if the user needs to be connected through a VPN to access either Github or Bamboo, this represents the Secure zone.
- A new GitHub instance is being added and it is not whitelisted in the Firewall rules.
Solution
Check the Network connectivity between the Bamboo and Github servers. Once you enable the network connection between both, it should work as expected.