Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure durable functions sample says sync functions are not allowed

Tags:

azure

I'm stepping through Azure training. I'm currently looking at https://docs.microsoft.com/en-us/learn/modules/create-long-running-serverless-workflow-with-durable-functions/4-exercise-create-a-workflow-using-durable-functions .

When I got to "Verify that the durable functions workflow starts" I noticed something was wrong. Instead of the json response that it predicted, I got a blank screen. Then, I checked the log of the HttpStart function, and I saw this:

Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead.

I'm not sure where I would do that, but at this point I went through all of the previous instructions looking for variances. The only thing I noticed was that in the instructions, where it showed what the "function.json" for HttpStart should look like, I noticed it had this:

"authLevel": "anonymous",

But I had this:

"authLevel": "function",

What I have seems more correct, in any case, so I think what was shown in the instructions was incorrect.

I also noticed that the instructions described installing the "Azure DurableTask extension", but I didn't see any prompt to install this.

I didn't see any other variances from the instructions.

I then googled the error message. The following seems relevant, but I don't know how or whether this really applies: https://github.com/dotnet/aspnetcore/issues/7644 .

like image 368
David M. Karr Avatar asked Feb 01 '20 17:02

David M. Karr


People also ask

How do you make a durable function in Azure?

Add functions to the appRight-click the project in Visual Studio and select Add > New Azure Function. Verify Azure Function is selected from the add menu, enter a name for your C# file, and then select Add. Select the Durable Functions Orchestration template and then select Add.

What is authorization level in Azure functions?

Azure HTTP authorization level, Determines what keys, if any, need to be present on the request in order to invoke the function.


2 Answers

forget the last sentence of my comment above regarding reverting to version 2.

I have changed my runtime version to version 2 and this time the HTTP Trigger was successful in running. To change the runtime version, I clicked on the "Function App settings" link underneath the Configured features heading on the Overview tab of the durable function I created overview tab

In the Function app settings tab, I selected the ~2 button to change the runtime version to 2.0.xxxx app settings tab

Also, just to make sure the durable functions package was installed, I ran

npm view durable-functions

like image 157
Langfo Avatar answered Nov 07 '22 11:11

Langfo


Another workaround without changing the azure SDK version is to add a compatibility app setting and setting it to true.

Go to:

  • Platform Features
  • Configurations
  • Function Runtime Settings and
  • add FUNCTIONS_V2_COMPATIBILITY_MODE and set it to true

This seems to do the trick while the azure-functions-durable package gets this fixed to deal with synchronous calls within the library, see the issue on GitHub

like image 35
dave_077 Avatar answered Nov 07 '22 10:11

dave_077