The process module in Node.js is a global object that provides information and control over the current Node.js process. It’s essential for interacting with the runtime environment and managing the execution of Node.js applications. This module is available in the Azion Runtime through Node.js compatibility, where a frequent use case is reading environment variables, such as process.env, or scheduling work with nextTick inside a function.

The example below shows how to use the process module in a function:

/**
* An example of using the Node.js Process API in an Azion Function.
* Support:
* - Extended by library `process`
* Portions of this file Copyright Roman Shtylman, licensed under the MIT license.
* @module runtime-apis/nodejs/process/main
* @example
* // Execute with Azion Bundler:
* npx edge-functions build
* npx edge-functions dev
*/
import { env, nextTick } from "node:process";
/**
* Example of using the process api
* @param {*} event
*/
const main = async (event) => {
console.log(process.env.NODE_ENV);
nextTick(() => {
console.log("Hello, Next Tick!");
// Hello, Next Tick!
});
return new Response(`NODE_ENV: ${process.env.NODE_ENV}`, { status: 200 });
};
export default main;