0

I'm currently facing a CORS (Cross-Origin Resource Sharing) issue with my Azure Function App, which is running on a Flex Consumption host model. It was developed locally and deployed to a Azure. I'm encountering the following error when trying to call the function from the protal:

HTTP response code: 0 Unknown HTTP error HTTP response content: Error: {"message":"Failed to fetch","stack":"TypeError: Failed to fetch\n at https://portal.azure.com/Content/Dynamic/qTMV9j3qzPmv.js:227:24350","isError":true}

Here are the steps I've taken so far:

  • Enabled CORS in Azure Portal in both Azure Function App and Azure Storage Account (Blob and File service - GET,POST,PUT allowed methods)
  • Verified the settings in the "Configuration" section under "Settings" in the Azure portal
  • Tried Incognito Mode
3
  • Do you have Access restrictions enabled in Azure function App? Commented Jul 15, 2024 at 7:58
  • 1
    Access restrictions might be enabled in our Azure Function App. This occurred while I was working on a client's project, so it's possible that specific restrictions or configurations were applied based on the project's requirements. Commented Jul 15, 2024 at 11:13
  • Check if below solution helps to resolve the issue. Commented Jul 23, 2024 at 11:52

1 Answer 1

2

This error occurs if the access restrictions is enabled in the Azure function App.

  • Enable access to all networks or grant access from Ip Address or virtual network.

enter image description here

enter image description here

Configure CORS to allow origins:

enter image description here

Portal:

  • After enabling network access, able to run the function.

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.