question

coder-902 avatar image
0 Votes"
coder-902 asked ajkuma-MSFT answered

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

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-functionsazure-static-web-apps
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@coder-902, Please accept my apologies for the delayed response on this!

To understand the issue better and for a deeper investigation, I would like to understand more info on your App (for this, I'll reach out you privately).

To isolate the issue further, review the diagnostics logs.

-Currently, Bring your own functions to Azure Static Web Apps is only supported in the Static Web Apps production environment.

Others limitations:
While your Azure Functions app may respond to various triggers, the static web app can only access functions via Http endpoints.
Only one Azure Functions app is available to a single static web app.
The api_location value in the workflow configuration must be set to an empty string.

Additionally, see Azure Static Web Apps hosting plans
-Bring your own functions is only available in the Azure Static Web Apps Standard plan.

Kindly let us know, I'll follow-up with you offline/privately for a quick and immediate assistance.

Thanks for your patience and great cooperation!


0 Votes 0 ·

1 Answer

ajkuma-MSFT avatar image
0 Votes"
ajkuma-MSFT answered

@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!

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.