The Node.js 14 runtime for Azure Functions is now generally available. It is the latest long-term supported (LTS) version of Node.js. In your functions, you can take advantage of new features in Node.js 14, including:
In addition to CommonJS modules, you have the option to use ECMAScript modules (ES modules) in Node.js 14. ES modules are now the official standard format for modules in Node.js.
To write Azure Functions in ES modules format, change your function’s file extension to .mjs. You can then use ES modules import and export statements in your code.
// index.mjs
import { getClient } from "durable-functions";
export default async function (context, req) {
const client = getClient(context);
const instanceId = await client.startNew(req.params.functionName, undefined, req.body);
return client.createCheckStatusResponse(context.bindingData.req, instanceId);
};
As ECMAScript modules are currently in “experimental” status in Node.js 14, they are supported in Azure Functions as a preview feature. To learn more, check out our documentation.
Node.js has a published release schedule. Update your function apps to Node.js 14 to ensure you’re on the latest long term supported version.
When you run Azure Functions locally, it uses the default version of Node.js on your machine. Download and install Node.js 14. While Node.js is highly compatible with earlier versions, make sure to test your app locally and in Azure. To change a function app’s Node.js version in Azure, see the Azure Functions Node.js Developer Guide.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.