Azure Static Web App with Managed Function App/API - how to set the node version

TK 1 Reputation point
2022-06-28T04:39:08.113+00:00

I have an Azure Static Web App with an API (Managed Function App using node.js) and i am getting an error "unexpected token '.' " when using the chaining operator. I assume i need to tell it to use node.js 14+ (LTS v14.17.3), but i cant work out how to.

If it was not managed, i would just set it when I create the Function App. I have tried setting some Configuration - App settings on the Static Website, but nothing works and some values are not accepted e.g.
"Failed to update application settings: AppSettings is invalid. {"Error":{"Code":"InvalidAppSettings","Message":"AppSetting with name(s) 'WEBSITE_NODE_DEFAULT_VERSION' are not allowed. See link https://go.microsoft.com/fwlink/?linkid=2161641 for allowed names.","ExtendedData":null,"Details":null}}"

Can anyone help please?

Edited: am using Oryx for deployment with

  • task: AzureStaticWebApp@0
    inputs:
    app_location: /mywebsite
    api_location: /mywebsite/api
    azure_static_web_apps_api_token: $(deployment_token)

I tried adding added "engines" to my package.json.
{
"name": "mywebsite",
"version": "0.1.0",
"private": true,
"engines": {
"node": ">=14.17.3"
},
"dependencies": {
...
this made the Oryx deploy the Static Website with v17, but has not affected the managed function app it is still using v12. :-(

Note: i have two package.json's one for the website and one in the API folder. i have updated both of them, but only the website was affected.

Am wondering if i can use the Oryx "api_build_command", but i cant find any documentation on what to set it to.

https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/azure-static-web-app?view=azure-devops#example

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
317 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
2,621 questions
{count} votes