Azure-functions-durable-extension: Local debug and CORS

Created on 5 Feb 2019  路  2Comments  路  Source: Azure/azure-functions-durable-extension

Describe the bug
When debugging locally a combination of a azure function/durable task and a front end application. If I want to track the progress of my task in the front end application, it is not possible because the durable tasks extension doesn't handle CORS request, so the browser will block any request to the statusQueryGetUri and other URIs

Investigative information

  • Durable Functions extension version: 1.7.1
  • Function App version (1.0 or 2.0): 2.0
  • Programming language used: C#

To Reproduce
Steps to reproduce the behavior:

  1. Create a durable task that is triggered by an http trigger https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-concepts#c
  2. Create a simple front end application that queries on the status
//fetch request to the function getting the status response
await fetch(status.statusQueryGetUri);
  1. You'll have CORS error messages in the console.
  2. See error

Expected behavior
fetch request to succeed when debugging locally.

Actual behavior
Getting CORS error messages in the console

Access to fetch at 'http://localhost:7071/runtime/webhooks/durabletask/instances/3e0095001e644680873312373400cb68?taskHub=DurableFunctionsHub&connection=Storage&code=r3IuoMv54hcP4ULprjOIBJvvnVxbN54s7asAtczw77fStYZbIMo4ug==' from origin 'https://baywet.sharepoint.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Most helpful comment

When running locally, the Azure Functions Core Tools allows you to specify CORS configuration in either the command-line or in the local.settings.json file, as described here: https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local#local-settings-file. Does doing this unblock your scenario?

All 2 comments

When running locally, the Azure Functions Core Tools allows you to specify CORS configuration in either the command-line or in the local.settings.json file, as described here: https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local#local-settings-file. Does doing this unblock your scenario?

Thanks! I had somehow not come across that in my searches. Closing.

Was this page helpful?
0 / 5 - 0 ratings