This document will help you get started with Functions. You can explore real-world serverless function code examples and tutorials to get inspired. Visit our Community forum to join the conversation about Functions.
Configure the functions folder
To get started, designate a directory in your repository where Netlify can find your serverless functions. Netlify will access this directory during every deploy, zipping and deploying each supported code file as a serverless Lambda function on AWS. (Note that, with one exception, any files in subdirectories will be ignored.)
In the Netlify web interface, go to Settings > Functions and enter a path to the directory in your repository where your serverless functions will be stored. You can also set this by adding a
functions field to your
netlify.toml file. (Settings in
netlify.toml override settings in the web interface.)
The path is relative to the root of the repository, and is accessed by Netlify after running your build command. This has the following implications:
- Your site must have a build command. If your site doesn't require a build step, you can set the build command to
- You can use your preferred workflow and tools for developing your serverless functions, then compile at build time to single files in the designated functions directory. (We’ve even made a tool to help you with this.)
- You can access Netlify environment variables to inject API keys or other information you don’t want to store in your repository.
Environment variable limits
Because Netlify Functions are powered by AWS Lambda, AWS’s environment property limits apply to environment variables used with Netlify Functions.
- Though we process the files in the functions directory after running your build command, the directory is not visible over the web unless you place it in your site’s publish directory (not recommended).
- Because the functions are deployed after the build, deploying serverless functions via this method requires continuous deployment. Alternatively, you can deploy serverless functions manually using Netlify CLI.
Languages and language settings
Did you find this doc useful?
Your feedback helps us improve our docs.