An Azure service that provides streamlined full-stack web app development.
The cause of the 500 error for a single managed function cannot be determined from the available context because there is no access to the specific Functions host logs for that Static Web App.
From the provided guidance, the only supported diagnostics paths are:
- Validate deployment and folder configuration
- Confirm that the
api_locationin the Static Web Apps workflow matches the root folder of the Functions app (typicallyapi). - Misconfigured
api_locationcan cause API issues even when the build is green, and errors may not surface clearly in the app:-
Either no API directory was specified, or the specified directory wasn't found.
-
- Ensure the workflow’s
app_location,output_location, andapi_locationare all aligned with the repo structure.
- Inspect build and deployment logs
- In GitHub → Actions → select the Static Web Apps workflow run → open Build and Deploy Job → Build And Deploy.
- Review the Oryx build output for any warnings or errors related to the Functions runtime or the
responsesfunction.
- Use Application Insights for runtime errors
- Ensure Application Insights is enabled for the Static Web App so that server errors are captured.
- In the Azure portal:
- Open the resource group for the Static Web App.
- Open the associated Application Insights resource.
- Under Investigate, select Failures and drill into failed operations.
- Only errors occurring after Application Insights is enabled will appear.
- Check for runtime/runtime-detection issues in Node Functions
- For Node-based Functions, verify that any
applicationinsightsdependency (if present) is at a supported version (for example,^2.7.1or higher) to avoid runtime detection issues such as:-
WARNING: Failed to detect the Azure Functions runtime. Switching "@azure/functions" package to test mode - not all features are supported.
-
- After changing dependencies, run
npm installand redeploy.
- Confirm platform/runtime constraints
- Managed Functions in Static Web Apps must comply with the documented constraints:
- HTTP-only triggers and bindings.
- Supported runtimes only (Node.js 12/14/16/18/20 (preview), .NET Core 3.1, .NET 6/7/8, Python 3.8/3.9/3.10).
- No use of reserved application setting prefixes (for example,
FUNCTIONS_,WEBSITE_,AzureWeb, etc.) or reserved tags (AccountId,EnvironmentId,FunctionAppId).
- If the
responsesfunction relies on any setting using a reserved prefix, the host may fail that function at startup.
If these checks do not reveal the issue, the next step is to use the documented support channels for Azure Functions/Static Web Apps and provide them with the Functions host logs and the failing function’s configuration.
References: