0

I created an Azure Static Web App with Function App - Managed Backend as shown below.

enter image description here

The whole system has been working for many weeks since April 2023 when I created the system. My Azure Web app calls the HTTP Trigger and is able to get the variables it needs. It was working till yesterday when it started to not work anymore today.

I get this error in my code. It seems that the Function App is no longer working. I need to know why it failed all of a sudden without me doing anything different with the code.

enter image description here

I checked the application. The Azure Web App is to call AzureStaticWebAppHTTPTrigger to get some configuration settings need to run another API. Once the variables are retrieved, the AzureStaticWebAppHTTPTrigger would call the next API thru Azure API Management Service (APIM).

I manually called the next API in (APIM) by getting the config variables in my Azure Static Web App and was able to call the API successfully. Hence the issue is indeed in the AzureStaticWebAppHTTPTrigger that is innate in my Azure Static Web app. Altho I am not sure why it is not working all of a sudden

[new update] I checked Application Insights and I get this error. Altho I am not sure why my Azure Static web app is no longer authorized to call its own Managed Function.

enter image description here

1 Answer 1

0

I was able to solve this by checking the code of the api.

[FunctionName("AzureStaticWebAppHttpTrigger")]

        public static async Task<IActionResult> Run(

        [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,

        ILogger log)

I noticed that the AuthorizationLevel.Function is restricting the access. I changed it to Anonymous and everything works out now.

I dont understand how this code change can happen though because I have been using this application for quite a while. I never recall changing the AuthorizationLevel setting

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.