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);
});