Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BadRequestObjectResult does not return detailed error message to the client

I have a Azure function with an HTTP trigger. It produces a 400 response when an input value is not specified:

if (string.IsNullOrEmpty(artistName))
{
    return new BadRequestObjectResult("Artist name not specified.");
}

When the function is running locally (func host start) and the API is called incorrectly (I am using curl -X POST ...), the above error message is shown.

When deployed to Azure and called in a similar way - instead of the detailed error message - only Bad Request is returned.

Why?
How can I change this behaviour?

like image 249
Marek Grzenkowicz Avatar asked Mar 15 '26 16:03

Marek Grzenkowicz


1 Answers

It's a known issue for function runtime 2.0.11888 that HttpTrigger does not return response content properly.

If you want to solve this, go to Application settings, pin your FUNCTIONS_EXTENSION_VERSION to previous runtime 2.0.11857-alpha until new version is released.

See Azure Functions Runtime 2.0.11888 Preview.

Update

This issue has already been fixed from 2.0.11933.

like image 194
Jerry Liu Avatar answered Mar 17 '26 20:03

Jerry Liu