Getting a BadGateway error when trying to create Azure DevOps Work items using Power Automated
I was recently trying to create an Azure DevOps work item when an email is received using the Power Automate 'Create an Azure DevOps work item when email arrives with 'Bug' in subject' template.
The flow created without issue, and all the drop downs were correctly populated with O365 and Azure DevOps values as expected.
However, when the flow ran, on receiving an email to the correct inbox, it failed with a BadGateway error.
The problem turned out to be that the Work Item type I had set the flow to create was not available in the project I was trying to create it in (it was disabled in the process template).
So, if you get a BadGateway (502) error in Power Automated Flow, do not assume Azure DevOps is down, but rather you have a bad/invalid payload in the call being made to the Azure DevOps API. I think what is happening is the Azure DevOps API is returning a 4xx bad data error (which may have a bit more detail, but I doubt it from my past REST API experience), but you cannot see it as Power Automate is hiding that error with its own 502 BadGateway error.
So the tip is check the details of your payload and ensure it is valid for the API you are calling.