tinglesoftware / dependabot-azure-devops

Tools for updating dependencies in Azure DevOps repositories using https://dependabot.com
MIT License
201 stars 66 forks source link

Running Dependabot@2 causing 500 internal sql exception via pipeline in ADO #1438

Closed mouaxiong1980 closed 5 days ago

mouaxiong1980 commented 3 weeks ago

Describe the bug I've added the dependabot extension to our ADO. When I try to go and run the pipeline to run dependabot, it gives me the following error:

🌎 🠊 [POST] https://dev.azure.com/EnvisionTechnologyPartners/WebIZ/_apis/git/repositories/WebIZ.Graph/pullrequests 🌎 🠈 [500] Internal Server Error {"$id":"1","innerException":null,"message":"TF400898: An Internal Error Occurred. Activity Id: b7ecf655-43d8-42bc-bf5b-e093cf56dce6.","typeName":"Microsoft.Data.SqlClient.SqlException, Microsoft.Data.SqlClient","typeKey":"SqlException","errorCode":0,"eventId":0}

[error]Failed to create pull request: Error: Request to 'https://dev.azure.com/EnvisionTechnologyPartners/WebIZ/_apis/git/repositories/WebIZ.Graph/pullrequests' failed: 500 Internal Server Error

Error: Request to 'https://dev.azure.com/EnvisionTechnologyPartners/WebIZ/_apis/git/repositories/WebIZ.Graph/pullrequests' failed: 500 Internal Server Error at AzureDevOpsWebApiClient.restApiRequest (/home/vsts/work/_tasks/dependabot_d98b873d-cf18-41eb-8ff5-234f14697896/2.36.1003/utils/azure-devops/AzureDevOpsWebApiClient.js:521:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async AzureDevOpsWebApiClient.restApiPost (/home/vsts/work/_tasks/dependabot_d98b873d-cf18-41eb-8ff5-234f14697896/2.36.1003/utils/azure-devops/AzureDevOpsWebApiClient.js:498:16) at async AzureDevOpsWebApiClient.createPullRequest (/home/vsts/work/_tasks/dependabot_d98b873d-cf18-41eb-8ff5-234f14697896/2.36.1003/utils/azure-devops/AzureDevOpsWebApiClient.js:188:33) at async DependabotOutputProcessor.process (/home/vsts/work/_tasks/dependabot_d98b873d-cf18-41eb-8ff5-234f14697896/2.36.1003/utils/dependabot-cli/DependabotOutputProcessor.js:67:42) at async DependabotCli.update (/home/vsts/work/_tasks/dependabot_d98b873d-cf18-41eb-8ff5-234f14697896/2.36.1003/utils/dependabot-cli/DependabotCli.js:113:51) at async run (/home/vsts/work/_tasks/dependabot_d98b873d-cf18-41eb-8ff5-234f14697896/2.36.1003/index.js:75:57)

I am able to see that the branches get created successfully however the PRs fail to get created. I've reached out to MSFT and they've asked me to contact Tingle instead since they believe the error is happening when the request is coming from Dependabot.

Categorization

Repository URL: e.g. https://dev.azure.com/tingle/dependabot/_git/repro-684

I'm more than happy to do a screen share upon request.

To Reproduce Steps to reproduce the behavior:

  1. Run the pipeline

Expected behavior I expect dependabot to successfully run and create the PRs for review. At the moment, it is only creating the branches and then failing on a 500 error as described above.

Logs and screenshots [If applicable, include relevant logs or screenshots to help explain your problem. See extension troubleshooting for more on how to collect additional diagnostic logs. ] https://app.screencast.com/H9yNtrJEknYSh https://app.screencast.com/acJoiTt6DtxRi

Extension (please complete the following information):

Server (please complete the following information): N/A

Additional context Add any other context about the problem here.

rhyskoedijk commented 3 weeks ago

@mouaxiong1980 thanks for the report. Are you able to share the relevant parts of your dependabot.yml file for this update?

Unfortunately the error returned by DevOps is not very useful and doesn't help identify what is wrong with the request. We might be able to narrow it down by understanding your configuration better. The values sent to DevOps during this API call are:

Are you able to determine what these values would have been be so we can eliminate them as being an issue?

mouaxiong1980 commented 3 weeks ago

Hi Rhys,

Please see the information below for answers to your questions:

Unfortunately the error returned by DevOps is not very useful and doesn't help identify what is wrong with the request. We might be able to narrow it down by understanding your configuration better. The values sent to DevOps during this API call are:

sourceRefName: this can be found in your repo branches as you mentioned it was already created. https://dev.azure.com/EnvisionTechnologyPartners/WebIZ/_git/WebIZ.Graph?path=%2F&version=GBfeatures%2Fmxiong%2F111908_dependabot&_a=contents targetRefName: this is set from "target-branch" config in your dependabot.yml, or it is the name of the default branch if not set in dependabot.yml I'm not setting this so it would be whatever is the default. title: this can be found your task output log if you scroll up a bit from the "[500] Internal Server Error" message dependabot(deps): bump the patch-updates group in /src with 2 updates description: this can be found your task output log if you scroll up a bit from the "[500] Internal Server Error" message 'Description has been truncated', reviewers: this is set from "reviewers" and "assignees" config in your dependabot.yml Assignees: *

Please let me know if you have any other questions.

Moua Xiong


From: Rhys Koedijk @.> Sent: Monday, October 28, 2024 7:03 PM To: tinglesoftware/dependabot-azure-devops @.> Cc: mouaxiong1980 @.>; Mention @.> Subject: Re: [tinglesoftware/dependabot-azure-devops] Running @.*** causing 500 internal sql exception via pipeline in ADO (Issue #1438)

@mouaxiong1980https://github.com/mouaxiong1980 thanks for the report. Are you able to share the relevant parts of your dependabot.yml file for this update?

Unfortunately the error returned by DevOps is not very useful and doesn't help identify what is wrong with the request. We might be able to narrow it down by understanding your configuration better. The values sent to DevOps during this API call are:

Are you able to determine what these values would have been be so we can eliminate them as being an issue?

— Reply to this email directly, view it on GitHubhttps://github.com/tinglesoftware/dependabot-azure-devops/issues/1438#issuecomment-2442897605, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AT4XTE3V5JELFTUAASUUGF3Z53GFNAVCNFSM6AAAAABQXVR6G6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBSHA4TONRQGU. You are receiving this because you were mentioned.Message ID: @.***>

mouaxiong1980 commented 3 weeks ago

Hi,

Is there any updates on this?

Moua Xiong


From: Rhys Koedijk @.> Sent: Monday, October 28, 2024 7:03 PM To: tinglesoftware/dependabot-azure-devops @.> Cc: mouaxiong1980 @.>; Mention @.> Subject: Re: [tinglesoftware/dependabot-azure-devops] Running @.*** causing 500 internal sql exception via pipeline in ADO (Issue #1438)

@mouaxiong1980https://github.com/mouaxiong1980 thanks for the report. Are you able to share the relevant parts of your dependabot.yml file for this update?

Unfortunately the error returned by DevOps is not very useful and doesn't help identify what is wrong with the request. We might be able to narrow it down by understanding your configuration better. The values sent to DevOps during this API call are:

Are you able to determine what these values would have been be so we can eliminate them as being an issue?

— Reply to this email directly, view it on GitHubhttps://github.com/tinglesoftware/dependabot-azure-devops/issues/1438#issuecomment-2442897605, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AT4XTE3V5JELFTUAASUUGF3Z53GFNAVCNFSM6AAAAABQXVR6G6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBSHA4TONRQGU. You are receiving this because you were mentioned.Message ID: @.***>

rhyskoedijk commented 3 weeks ago

Is there any updates on this?

I haven't had a chance to look in to it further yet, but hope to sometime over this weekend.

I do see that you are using assignees/reviewers. If you haven't already, it might be worth commenting out these in your dependabot.yml file and seeing if that allows the PR to be created; If so, that would certainly narrow down the problem area.

rhyskoedijk commented 1 week ago

@mouaxiong1980 best guess is that there is a duplicated identity in your assignee/reviewers config. I can see that "Team 3" is listed as both an assignee and reviewer, the masked email address might be a duplicate too. Each identity should be either an assignee or review, but not both.

I have submitted a change in https://github.com/tinglesoftware/dependabot-azure-devops/pull/1457 that will filter out duplicated identities. Until this is merged, you should be able to work around the error by manually removing all duplicate identities from your dependabot.yml config.

mouaxiong1980 commented 1 week ago

Thanks for the update. Simply commenting out the assignee and reviewee seemed to have fixed the issue for now. From your comment, are you also saying that we shouldn't have the same entity/person assigned as a reviewee and assignee? I just want to understand this setting. Thanks.

Moua Xiong


From: Rhys Koedijk @.> Sent: Sunday, November 10, 2024 10:14 PM To: tinglesoftware/dependabot-azure-devops @.> Cc: mouaxiong1980 @.>; Mention @.> Subject: Re: [tinglesoftware/dependabot-azure-devops] Running @.*** causing 500 internal sql exception via pipeline in ADO (Issue #1438)

@mouaxiong1980https://github.com/mouaxiong1980 my best guess is that there is a duplicated identity in your assignee/reviewers list. I can for example see that "Team 3" is listed as both an assignee and reviewer, this might also be true for the masked email address.

I have submitted a change in #1457https://github.com/tinglesoftware/dependabot-azure-devops/pull/1457 that will filter out duplicated identities. Until this is merged, you can probably work around this issue by manually removing duplicates in your dependabot.yml config.

— Reply to this email directly, view it on GitHubhttps://github.com/tinglesoftware/dependabot-azure-devops/issues/1438#issuecomment-2467196460, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AT4XTE5PLZDB3WOP4YRRL5D2AAVJJAVCNFSM6AAAAABQXVR6G6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRXGE4TMNBWGA. You are receiving this because you were mentioned.Message ID: @.***>

rhyskoedijk commented 1 week ago

@mouaxiong1980 correct, DevOps does not support the concept of "assignees" for pull requests, it only has reviewers. So when creating a pull request, the list of assignees and reviewers from dependabot.yml are combined in to a single list. If that list contains duplicate identities, the 500 error will happen.

In the Azure DevOps implementation, there is no real benefit in adding the same identity to both assignees and reviewers, since they are the same thing.

After https://github.com/tinglesoftware/dependabot-azure-devops/pull/1457 is merged, the extension will filter out duplicates automatically to make this less confusing and annoying.