I'm accessing a user definable API through a service webhook in Azure DevOps. I can tell from my information event logging that the script runs completely fine. At the end of the script I do this.
return new ApiTriggerOutput
{
ResponseCode = (int)StatusCode.Ok,
};
But in Azure DevOps I get an internal server error with code 500.
If my request is in an incorrect format, I have some checks in my script that then return something like this:
return new ApiTriggerOutput
{
ResponseBody = $"Azure DevOps project with id {workItem.resourceContainers.project.id} is not supported",
ResponseCode = (int)StatusCode.BadRequest,
};
These response codes come in correctly into Azure DevOps.
What's happening?
EDIT: Full response:
Status Code: 500
Reason Phrase: Internal Server Error
HTTP Version: 1.1
Headers:
{
Connection: keep-alive
Request-Context: appId=cid-v1:e6146ee8-8f7e-4826-92a9-9e3220cf1975
TunnelConnection: 04f72ccd-573f-4ea4-abf7-aeff6b604a18
TunnelForwarded: True
Strict-Transport-Security: max-age=15552000; includeSubDomains
SL-Filter: ALLOWED (single request, by path), time=2024-2-22 9:10:45
Content-Security-Policy: frame-ancestors 'self'
X-Content-Type-Options: nosniff
X-Frame-Options: deny
Date: Thu, 22 Feb 2024 08:10:45 GMT
Set-Cookie: TunnelConnection=04f72ccd-573f-4ea4-abf7-aeff6b604a18; path=/; secure; httponly
Content-Length: 235
Content-Type: application/json; charset=utf-8
}
Hi Toon,
Can you check the SLUserDefinableApiManager.txt log file? This may reveal what may have gone wrong when the API script response is being handled.
The current internal test version had an issue where an API would fail when you did not define any response body. Can you check if that DMA is running a test version and does not use a response body? The next official release won't have this issue.
Indeed, specifying a response body fixes the issue. Thanks for the help!