Static Web App API POST requests are failing

Stuey Kent 1 Reputation point
2021-09-12T11:43:06.243+00:00

I have a static web app setup and deploy here: contact-us. I also have a function setup through the integrated API routes here: api/stuey.

Developing localy, making GET requests through the browser or POST requests using cURL all work great with the expected results, but when I try and use a fetch between the deployed app and the API I get a 500 response with the body "Function call failure".

I have tried stripping back my implementation but no luck. Below is the code for my fetch (called on submission of the form) and the function is the standard out the box "This HTTP triggered function executed successfully" example.

Any hints to what I am doing wrong would be greatly appreciated.

 fetch('/api/stuey',  
      {  
        method: 'POST',  
        headers: {  
          'Content-Type': 'application/json',  
        },  
        body: JSON.stringify({ name: 'stuey' }),  
      },  
    ).then((res) => {  
      console.log(res);  
    });  

131341-functioncallfailure.png

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,261 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
762 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 22,401 Reputation points Microsoft Employee
    2021-10-02T12:37:49.007+00:00

    To benefit the community posting the summary of the issue - During the time of issue reported/occurence users leveraging BT network had issues accessing Azure static sites and then it was mitigated later : Reference - https://twitter.com/rowlandshaw/status/1435165519607435268

    Thanks StueyKent-7425 for reporting this issue. I'd followed-up on this privately to confirm the mitigation/fix.

    0 comments No comments