-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
durable function Http starter function failed #175
Comments
@andyzhu Can you add an app setting named Can you let us know what sample you're trying and we can look into fixing it? For now, the simplest fix is the setting above. There's a bit more information about this on the quickstart. It's a point-in-time problem that we hope will be addressed soon. Sorry about that. |
i am using the azure portal to try out the durable function, where do I set the FUNCTIONS_V2_COMPATIBILITY_MODE? in functions.json file? if so , how? I am actually follow the instruction on Azure Learn, @ |
@andyzhu Thanks. We’ll get that updated. You can configure the setting like this: https://docs.microsoft.com/en-us/azure/azure-functions/functions-how-to-use-azure-function-app-settings#settings |
@anthonychu I did try with the setting set to true, and it keeps failing. There is a workaround to this issue by changing the functions version to ~2 and enabling synchronous operations. |
Found that looking at the durableorchestrationclient.ts which contains the startNew method, it seems that the problem is with a synchronous operation performed by the axios library, in durableorchestrationclient.ts line 606:
When you pass undefined as the second parameter, the Exception InvalidOperationException is thrown by the SDK. If you pass anything else, an empty string, null, etc, the exercise code will run without problems. I suppose that if you change this to always call JSON.stringify the input it would work correctly. #176 Also look at the starkoverflow discussion |
I found out how to change the setting to enable v2 support, MSFT also took notes to correct their tutorial in the future. i am closing the issue. |
I found out how to change the setting to enable v2 support, MSFT also took notes to correct their tutorial in the future. i am closing the issue. |
Error when try to the sample code:
const df = require("durable-functions");
module.exports = async function (context, req) {
const client = df.getClient(context);
const instanceId = await client.startNew(req.params.functionName, undefined, req.body);
};
The above highlighted code cause the following error
2020-04-04T02:24:40.434 [Information] Executing 'Functions.HttpStart' (Reason='This function was programmatically called via the host APIs.', Id=7dd0fb95-dd62-4781-a002-3ef44620aaad)
2020-04-04T02:24:50.700 [Error] Executed 'Functions.HttpStart' (Failed, Id=7dd0fb95-dd62-4781-a002-3ef44620aaad)
Result: Failure
Exception: Error: The operation failed with an unexpected status code: 500. Details: {"Message":"Something went wrong while processing your request","ExceptionMessage":"Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead.","ExceptionType":"System.InvalidOperationException","StackTrace":" at Microsoft.AspNetCore.Server.IIS.Core.HttpRequestStream.Read(Byte[] buffer, Int32 offset, Int32 count)\r\n at Microsoft.AspNetCore.Server.IIS.Core.WrappingStream.Read(Byte[] buffer, Int32 offset, Int32 count)\r\n at System.Net.Http.DelegatingStream.Read(Byte[] buffer, Int32 offset, Int32 count)\r\n at System.IO.StreamReader.ReadBuffer(Span
1 userBuffer, Boolean& readToUserBuffer)\r\n at System.IO.StreamReader.ReadSpan(Span
1 buffer)\r\n at System.IO.StreamReader.Read(Char[] buffer, Int32 index, Int32 count)\r\n at Newtonsoft.Json.JsonTextReader.ReadData(Boolean append, Int32 charsRequired)\r\n at Newtonsoft.Json.JsonTextReader.ParseValue()\r\n at Newtonsoft.Json.JsonTextReader.Read()\r\n at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)\r\n at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)\r\n at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)\r\n at Microsoft.Azure.WebJobs.Extensions.DurableTask.HttpApiHandler.HandleStartOrchestratorRequestAsync(HttpRequestMessage request, String functionName, String instanceId) in C:\GitHub\azure-functions-durable-extension\src\WebJobs.Extensions.DurableTask\HttpApiHandler.cs:line 490\r\n at Microsoft.Azure.WebJobs.Extensions.DurableTask.HttpApiHandler.HandleRequestAsync(HttpRequestMessage request) in C:\GitHub\azure-functions-durable-extension\src\WebJobs.Extensions.DurableTask\HttpApiHandler.cs:line 152"}Stack: Error: The operation failed with an unexpected status code: 500. Details: {"Message":"Something went wrong while processing your request","ExceptionMessage":"Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead.","ExceptionType":"System.InvalidOperationException","StackTrace":" at Microsoft.AspNetCore.Server.IIS.Core.HttpRequestStream.Read(Byte[] buffer, Int32 offset, Int32 count)\r\n at Microsoft.AspNetCore.Server.IIS.Core.WrappingStream.Read(Byte[] buffer, Int32 offset, Int32 count)\r\n at System.Net.Http.DelegatingStream.Read(Byte[] buffer, Int32 offset, Int32 count)\r\n at System.IO.StreamReader.ReadBuffer(Span
1 userBuffer, Boolean& readToUserBuffer)\r\n at System.IO.StreamReader.ReadSpan(Span
1 buffer)\r\n at System.IO.StreamReader.Read(Char[] buffer, Int32 index, Int32 count)\r\n at Newtonsoft.Json.JsonTextReader.ReadData(Boolean append, Int32 charsRequired)\r\n at Newtonsoft.Json.JsonTextReader.ParseValue()\r\n at Newtonsoft.Json.JsonTextReader.Read()\r\n at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)\r\n at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)\r\n at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)\r\n at Microsoft.Azure.WebJobs.Extensions.DurableTask.HttpApiHandler.HandleStartOrchestratorRequestAsync(HttpRequestMessage request, String functionName, String instanceId) in C:\GitHub\azure-functions-durable-extension\src\WebJobs.Extensions.DurableTask\HttpApiHandler.cs:line 490\r\n at Microsoft.Azure.WebJobs.Extensions.DurableTask.HttpApiHandler.HandleRequestAsync(HttpRequestMessage request) in C:\GitHub\azure-functions-durable-extension\src\WebJobs.Extensions.DurableTask\HttpApiHandler.cs:line 152"}at DurableOrchestrationClient.createGenericError (D:\home\site\wwwroot\node_modules\durable-functions\lib\src\durableorchestrationclient.js:587:16)
at DurableOrchestrationClient. (D:\home\site\wwwroot\node_modules\durable-functions\lib\src\durableorchestrationclient.js:401:44)
at Generator.next ()
at fulfilled (D:\home\site\wwwroot\node_modules\durable-functions\lib\src\durableorchestrationclient.js:4:58)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
The text was updated successfully, but these errors were encountered: