forcedotcom / devops-center-feedback

61 stars 2 forks source link

Error, too many callouts on work item promotion #269

Open jakekarl opened 1 year ago

jakekarl commented 1 year ago

Describe the bug I have a project that I'm trying to deploy tickets from my UAT to Staging, however I'm running into the following error:

sf_devops:Too many callouts: 101

My project has 5 stages (dev, integrate, uat, staging, and production) and work items are able to move freely from dev to uat, but are now throwing this error specifically when trying to move to staging. I've tried moving a work item with many components and a work item with one single component so it doesn't appear to be any sort of volume issue.

I've read through what I can see in the generated logs and I can see this callout running 100 times (therefor hitting the error on the next 101st time). I'm unsure why this callout would be run so many times since its returning a 200. It appears to be stuck in some sort of loop, but interestingly only on this stage.

09:08:03:922 NAMED_CREDENTIAL_REQUEST NamedCallout[Named Credential Id=XXXXXXXXXXXXXXX, Named Credential Name=DevOps_Center_GitHub, Endpoint=https://api.github.com/repos/radianHub/radianHub/compare/d729d98b118314c0a786fbefdde72e1833b0827b...staging, Method=GET, External Credential Type=EXTERNAL, HTTP Header Authorization=Method: Bearer - Credential: xxxxxx, Content-Type=null, Request Size bytes=-1, Retry on 401=True] 09:08:04:223 NAMED_CREDENTIAL_RESPONSE NamedCallout[Named Credential Id=XXXXXXXXXXXXXXX, Named Credential Name=DevOps_Center_GitHub, Status Code=200, Content-Type=application/json; charset=utf-8, Response Size bytes=438527, Overall Callout Time ms=1253, Connect Time ms=1

To Reproduce Steps to reproduce the behavior:

  1. Create, build, and deploy a work item from dev environment to uat stage
  2. Attempt to promote any work item from uat to staging

Expected behavior Work item to be promoted from the uat stage to the staging stage

Screenshots If applicable, add screenshots to help explain your problem.

Screenshot 2023-09-09 at 9 47 06 AM

Additional context As far as I'm aware this is not happening on any other project with the same pipeline structure.

Schuchie commented 1 year ago

We are getting that error everywhere in the DevOps-Center. The only way I know to fix it, remove the whole pipeline and resetup it. After that the errors are gone.

vernemi2 commented 1 year ago

Same here, in order to fix this we had to create a new pipeline. Would be nice if this issue could be picked up at some point as re-creating the pipeline is not a really nice workaround. šŸ™

OPutria commented 1 year ago

We have the same issue with our pipeline. I hope it will be solved as soon as possible.

vernemi2 commented 1 year ago

Same here, in order to fix this we had to create a new pipeline. Would be nice if this issue could be picked up at some point as re-creating the pipeline is not a really nice workaround. šŸ™

After re-creating the pipeline the same issue resurfaced fairly quickly. Did a bit of reverse engineering based on the logs and it seems the issue happens when the commit ID on the branch does not match the commit ID of the tip of the branch in GitHub. It seems that the DevOps centre has some built-in functionality to align this, so it works most of the time. The issue is when there are lots of commits between the commit ID Salesforce stores and what is in GitHub.

To fix this open the dev console and find the log when the error appears. In the log find the following:

NAMED_CREDENTIAL_REQUEST NamedCallout[Named Credential Id=0XAMo00000003E1, Named Credential Name=DevOps_Center_GitHub, Endpoint=https://api.github.com/repos/`repo-name`/compare/`commit-id`...`branch-name`

Find the corresponding branch in Salesforce: SELECT Id FROM sf_devopsBranchc WHERE sf_devops__Remote_Reference__c = commit-id

Open the branch and update sf_devops__Remote_Reference__c to match the latest commit on the branch in GitHub. Would be great to hear something from the Salesforce team as this seems to be working fine. But of course I don't know if there might be an impact on something else potentially. Hope this helps in the meanwhile.

mslade24 commented 1 year ago

@vernemi2 Thank you so much for your solution. It worked great for me. Glad I didn't have to make a new pipeline.