Intermittent "Error 500" in api/alm_integration calls using SonarCloud

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps): Github
  • CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI): Github Actions
  • Scanner command used when applicable (private details masked):
* ./.sonar/scanner/dotnet-sonarscanner begin /project /o:company /d:sonar.token="***" /d:sonar.host.url=*** /d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml /d:sonar.cs.vstest.reportsPaths=*.trx /d:sonar.qualitygate.wait=true
  • Languages of the repository: C#(.net)
  • Only if the SonarCloud project is public, the URL
    • And if you need help with pull request decoration, then the URL to the PR too
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
ERROR: Something went wrong while trying to get the pullrequest with key '116'
ERROR: Caused by: Error 500 on ***api/alm_integration/show_pullrequest?project=project*&pullrequestKey=116 : {"errors":[{"msg":"An unexpected error occurred. Please try again later."}]}
  • Steps to reproduce
    It’s an intermittent error. Sometimes it returns right data and sometimes returns status code 500. Are there any performance problem with this SonarCloud Api?
    Status 200 OK:
{
    "branchName": "feat/retry",
    "baseBranchName": "main"
}

Status 500 (using exactly same call above):

{
    "errors": [
        {
            "msg": "An unexpected error occurred. Please try again later."
        }
    ]
}
  • Potential workaround

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!
It’s an intermittent error. The PullRequest and project exists, when we search by SonarCloud UI. Sometimes it returns right data and sometimes returns status code 500. Are there any performance problem with this SonarCloud Api?
It’s began nearly 4 days ago.

Hey @Bruno_Tanoue

There’s no sign in the logs that there’s a widespread issue here.

Digging into the logs, I do see a 403 being returned by GitHub while calling https://api.github.com/app/installations/<Install_ID>/access_tokens (GET api/alm_integration/show_pullrequest sends a request to GitHub).

I can’t find any difference between the “good” requests that return data, and the bad ones returning a 500 (because of the 403).

I’ve passed my investigation onto the responsible team. Maybe they have a better idea!

Hey Colin! How are you?
If you want, I can record my calls on Postman and send you, because I can reproduce the Github error locally.
Is there any place that I can send you a video or something else?
Thank you for the quick response.

Hello!
Any news?
We are receiving an intermittent error yet.
It’s breaking our pipeline many times and we need to rebuild.
Can we send X-Amz-Cf-Id for your analysis and debug?

X-Amz-Cf-Id: sMxLmaMOUQIMJS8ELRB3zbomM0RrGjLq3y6DaPMSlFyf0GmPLEz0Qg==

Att,

Hello @Bruno_Tanoue,

I apologize for the delay. As Colin mentioned, what’s causing this issue is that we are receiving a 403 from the GitHub call https://api.github.com/app/installations/{INSTALL_ID}/access_tokens.
We use this to generate a token to access your installation of our App.

By experiencing with this API call, the only way we managed to get a 403 was to suspend the GitHub App installation. I know it feels weird but before we go deeper, let me ask you: is it possible that your installation is getting suspended/unsuspended sometimes?

Fortunately, GitHub has Audit logs so you can check that, going to this URL: https://github.com/organizations/{ORG_NAME}/settings/audit-log and using the filter action:integration_installation.suspend OR action:integration_installation.unsuspend

Do you see such events happening or not?

Regards,

Antoine

Hi @Antonie, sorry for delay. Recently this error returned a lot for us. I got the audit-logs and using the recommended fitlers, we didn’t find anything about suspend or unsuspend events, as shown as below:

Is there something more that we can do?

Att,

Bruno Tanoue