SWA Azure Function backend returns 500 after 45 seconds, even though function keeps running afterwards

coder-902 201 Reputation points
2021-09-08T18:57:51.827+00:00

Hi there,

I'm working on a Static Web App using the integrated Azure Functions backend. I have a function which takes about 2.5 minutes to complete due to a large database upload in the function. I am having an issue where after exactly 45 seconds, the function call returns a 500 error. However, this error does not show up in App Insights and through App Insights I can tell the function is still running after this event.

The function will run to completion but I can not receive a response from the function after the 500. After the function finishes running I can look in the database and see the added records.

This issue is present in my deployed Staging Environment, but not when running locally. When I run locally the function behaves as expected.

It may be relevant that I specify
"engines": {
"node": "10.x"
}
in the backend's package.json as I need to accommodate an older library which depends on it.

Please let me know if I can provide more info!

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

1 answer

Sort by: Most helpful
  1. ajkuma 24,736 Reputation points Microsoft Employee
    2021-09-16T20:21:21.573+00:00

    @coder-902 , I'd been discussing on this internally and also awaiting for your reply. Current timeout value for functions proxied through Static Web Apps is 45 secs.
    I have relayed the feedback to our product engineering and content author team, we will make this more clear in the Azure docs. Thanks for your feedback! Apologies for any inconvenience with this.

    As an alternative, if feasible you could use durable functions in a 'bring your own' function app to kick off an orchestration for a long running workflow and poll for status (though the built in APIs for polling won't work in a static web app, you may need to create your own as per your requirement).

    Thanks for your patience and cooperation!