This document describes optional configuration settings you can use for more control over how your functions are built, deployed, and executed.
Choose your programming language:
Netlify will access the functions directory during every build, preparing and deploying each supported code file as a function. The default directory is
YOUR_BASE_DIRECTORY/netlify/functions. You can customize the directory using the Netlify UI or file-based configuration.
In the Netlify UI, go to Site settings > Functions and enter a path to the directory in your repository where you want to store your functions.
Alternatively, add the following to
netlify.tomlfor file-based configuration.
[functions] directory = "my_functions"
netlify.toml override settings in the Netlify UI.
For both methods, the path is relative to the site’s base directory in your repository. To help keep your site secure, make sure your functions directory is outside of your publish directory so that your source files aren’t deployed as part of your site.
For granular control over which files are bundled in your executable function artifacts, use the
included_files. Visit the file-based configuration doc for details.
[functions] # Flags "package-1" as an external node module for all functions. external_node_modules = ["package-1"] # Includes all Markdown files inside the "files/" directory. included_files = ["files/*.md"]
# Node.js version for runtime
For all TypeScript functions deployed on or after December 13, 2021, Netlify uses Node.js 14 as the default runtime.
In the Netlify UI, set the environment variable
AWS_LAMBDA_JS_RUNTIMEto the desired version. For example, to use Node.js 12 for all future functions deployed, set the variable value to
Re-deploy your site to apply the new runtime version.
Did you find this doc useful?
Your feedback helps us improve our docs.