Supported languages and runtimes in Azure Static Web Apps
Azure Static Web Apps features two different places where runtime and language versions are important, on the front end and for the API.
Runtime type | Description |
---|---|
Front end | The version responsible for running the website's build steps that build the front end application. |
API | The version and runtime of Azure Functions used in your web application. |
Front end
You can specify the version used to build the front end of your static web app. Configuring a non-default version is often only necessary if you need to target older versions.
You can specify the runtime version that builds the front end of your static web app in the package.json file in the engines
section of the file.
{
...
"engines": {
"node": ">=14.0.0"
}
}
API
The underlying support for APIs in Azure Static Web Apps is provided by Azure Functions. Refer to the Azure Functions supported languages and runtimes for details.
The following versions are supported for managed functions in Static Web Apps. If your application requires a version not listed, consider bringing your own functions to your app.
To configure the API language runtime version, set the apiRuntime
property in the platform
section to one of the following supported values.
Language runtime version | Operating system | Azure Functions version | apiRuntime value |
End of support date |
---|---|---|---|---|
.NET Core 3.1 | Windows | 3.x | dotnet:3.1 |
December 3, 2022 |
.NET 6.0 in-process | Windows | 4.x | dotnet:6.0 |
- |
.NET 6.0 isolated | Windows | 4.x | dotnet-isolated:6.0 |
- |
.NET 7.0 isolated | Windows | 4.x | dotnet-isolated:7.0 |
- |
.NET 8.0 isolated | Windows | 4.x | dotnet-isolated:8.0 |
- |
Node.js 12.x | Linux | 3.x | node:12 |
December 3, 2022 |
Node.js 14.x | Linux | 4.x | node:14 |
- |
Node.js 16.x | Linux | 4.x | node:16 |
- |
Node.js 18.x | Linux | 4.x | node:18 |
- |
Node.js 20.x (preview) | Linux | 4.x | node:20 |
- |
Python 3.8 | Linux | 4.x | python:3.8 |
- |
Python 3.9 | Linux | 4.x | python:3.9 |
- |
Python 3.10 | Linux | 4.x | python:3.10 |
- |
.NET
To change the runtime version in a .NET app, change the TargetFramework
value in the csproj file. While optional, if you set a apiRuntime
value in the staticwebapp.config.json file, make sure the value matches what you define in the csproj file.
The following example demonstrates how to update the TargetFramework
element for NET 8.0 as the API language runtime version in the csproj file.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
...
</PropertyGroup>
...
Node.js
The following example configuration demonstrates how to use the apiRuntime
property to select Node.js 16 as the API language runtime version in the staticwebapp.config.json file.
{
...
"platform": {
"apiRuntime": "node:16"
}
...
}
Python
The following example configuration demonstrates how to use the apiRuntime
property to select Python 3.8 as the API language runtime version in the staticwebapp.config.json file.
{
...
"platform": {
"apiRuntime": "python:3.8"
}
...
}
Re-enabling proxies in v4.x
Azure Functions supports re-enabling proxies in v4.x. To enable proxy support in managed functions for your static web app, set SWA_ENABLE_PROXIES_MANAGED_FUNCTIONS
to true
in your application settings.
[!NOTE] While proxies are supported in v4.x, consider using Azure API Management integration with your managed function apps, so your app isn't reliant on proxies.
Deprecations
Note
Now that Azure Functions v3 is retired, Static Web Apps uses Azure Functions v4 for API runtime support for Python 3.8. Redeploy your app to enable this change. While not recommended, you can revert back to v3 by setting the environment variable USEV3_FOR_PYTHON38
to true
.
The following runtimes are deprecated in Azure Static Web Apps. For more information about changing your runtime, see Specify API language runtime version in Azure Static Web Apps and Migrate apps from Azure Functions version 3.x to version 4.x.
- .NET Core 3.1
- Node.js 12.x