FunctionApps are failing with "0 Unknown HTTP error"

Varske 10 Reputation points
2024-06-11T10:55:45.14+00:00

Hi,

I was trying to build few functions apps and they work as intended for a day or just few hours, then it suddenly stops with the following message:

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/RANDOMCODE.js:226:23724","isError":true}

Same problem regardless of function's content (tested with a hardcoded response)

There also is a disclaimer about CORS:

Running your function in portal requires the app to explicitly accept requests from https://portal.azure.com. This is known as cross-origin resource sharing (CORS). ConfigureCORS to add https://portal.azure.com to allowed origins.Learn more

but even adding a wildcard for the allowed origins does not change anything.

Response headers are empty.

Accept:

application/json

Cache-Control:

no-cache

Content-Type:

application/json

Referer:

https://portal.azure.com/

Referrer:

strict-origin-when-cross-origin

do anyone know how this can be fixed?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,542 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SwathiDhanwada-MSFT 18,456 Reputation points
    2024-06-13T13:19:52.71+00:00

    @Varske To prevent malicious code execution on the client, modern browsers block requests from web applications to resources running in a separate domain. Cross-origin resource sharing (CORS) lets an Access-Control-Allow-Origin header declare which origins are allowed to call endpoints on your function app.

    When you configure the Allowed origins list for your function app, the Access-Control-Allow-Origin header is automatically added to all responses from HTTP endpoints in your function app. To configure the Allowed origins, you can traverse to respective function app and add the https://portal.azure.com/ in allowed list as shown in below image.

    User's image

    0 comments No comments