Advanced Node.js Usage
To use Node.js, create a file inside your project's directory. No additional configuration is needed.
The entry point for must be a glob matching , , or files that export a default function.
To disable helpers:
- From the dashboard, select your project and go to the Settings tab.
- Select Environment Variables from the left side in settings.
- Add a new environment variable with the Key: and the Value: . You should ensure this is set for all environments you want to disable helpers for.
- Pull your env vars into your local project with the following command:
For more information, see Environment Variables.
To install private npm modules:
- From the dashboard, select your project and go to the Settings tab.
- Select Environment Variables from the left side in settings.
- Add a new environment variable with the Key: and enter your npm token as the value. Alternatively, define as an Environment Variable with the contents of .
- Pull your env vars into your local project with the following command:
For more information, see Environment Variables.
In some cases, you may wish to include build outputs inside your Vercel Function. To do this:
- Add a script within your file, in the same directory as your Vercel Function or any parent directory. The nearest to the Vercel Function will be preferred and used for both installing and building:
- Create the build script named :
- Finally, create a file for the built Vercel functions, inside the directory:
When a SIGINT signal is sent to a Node.js function, it will terminate every function running on that Fluid instance. When implementing graceful shutdown patterns in your Node.js functions, keep this instance-wide termination behavior in mind.
Was this helpful?