I am trying to deploy NodeJS code to azure function via serverless framework. It is working correctly for node 14 but facing issue when I tried to deploy is node 18.
Ideally after deployment FUNCTIONS_EXTENSION_VERSION should set to ~4 but it is set as ~3
I am using below serverless yml file
service: node-azure
provider:
name: azure
region: East US
stage: dev
runtime: nodejs18
plugins:
- serverless-azure-functions
package:
exclude:
- node_modules/**
- .gitignore
- package.json
- .git/**
functions:
hello:
handler: handler.hello
events:
- http: true
x-azure-settings:
authLevel: anonymous
I tried creating and deploying Nodejs Function with serverless and yes by default it will take
nodejs12as a Function runtime for nodejs template, Butnodejs14,nodejs18,nodejs20are also supported parameters:-Refer my Github Repository for the serverless project.
My Default server.yml with
nodejs18:-Commands:-
Refer here for more details.
In command Prompt:-
Use
SET, For Bash useExport, For Powershell use$env:I am using command prompt:-
After setting all the environment variables deploy the Function by the command below:-
Output:-
Upgrade the Runtime version to 4 via Configuration settings:-
In order to Run the Function from Portal > Code + Test > Add the CORS settings below:-
If the issue persists, Raise a github issue here.