Internal server error returning integer from v2 function app

George Aggrey 21 Reputation points
2021-01-17T13:44:56.97+00:00

I am getting internal server errors when returning data from a v2 Azure function (.Net Core). I have reduced it to a very simple case:

   [FunctionName("invoke")]
    public static async Task<IActionResult> Run(
    [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req, ExecutionContext context)
    {
        try
        {

            var obj = new OkObjectResult(10);
            return obj;
        }
        catch (Exception e)
        {
            return new BadRequestObjectResult(e.ToString());
        }
    }

Strangely it happens on two of my subscriptions and not the third

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,607 questions
{count} votes

Accepted answer
  1. MayankBargali-MSFT 69,971 Reputation points
    2021-01-19T10:58:53.477+00:00

    Hi @George Aggrey

    Thanks for your time reaching offline.
    As discussed, you have confirmed that the issue is resolved and found that as you were deploying function using Terraform then in that case you should not set FUNCTIONS_EXTENSION_VERSION instead set azurerm_function_app.version

    Updating the FUNCTIONS_EXTENSION_VERSION to "2.0.15229.0" helps you to resolve the issue.

    0 comments No comments

0 additional answers

Sort by: Most helpful