Azure / azure-functions-templates

Azure functions templates for the azure portal, CLI, and VS
MIT License
340 stars 193 forks source link

Azure Durable Function project/function template wrong because of client.CreateCheckStatusResponse #1533

Open vijayrkn opened 2 months ago

vijayrkn commented 2 months ago

Creating the bug on behalf of the VS customer:

Link to the DevComm issue: https://developercommunity.visualstudio.com/t/Azure-Durable-Function-projectfunction-/10602888

[Ralph Jansen]

Reported Feb 27, 2024 1:02 PM When creating a new Durable Function Orchestration function in an Azure Function will successfully generate the code. Only the last line is wrong.

The last line is:

return client.CreateCheckStatusResponse(req, instanceId); This is wrong because the Function is async and results in a response 500 error instead of the “Status response” of a durable function. See below for complete error.

The following line is the correct line:

return await client.CreateCheckStatusResponseAsync(req, instanceId); When you execute the durable function (calling the HTTP trigger) with the generated (wrong) code will result in the following error and a 500 response:

Result: Function 'Function1_HttpStart', Invocation id '14c18dd9-5333-4103-ab0b-9a6f56a4ebc9': An exception was thrown by the invocation. Exception: System.InvalidOperationException: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.