It’s now easier to get started with Netlify Functions because you no longer need to configure a functions directory. Instead you can create a new directory in your site repo with the following path:
SITE_BASE_DIRECTORY/netlify/functions/
Then write your functions in JavaScript or Go inside that directory. As you work, you can run netlify dev
to test them locally. Then commit and push to your repo or run netlify deploy
to send your updates to Netlify. We’ll automatically package and deploy any functions in the default directory.
What if I want to use a different directory?
You still can! You can configure a custom functions directory in the Netlify UI or in a Netlify configuration file. If you’re already using Netlify Functions in your site, your configured functions directory will still work.
Note that if you set a custom functions directory, Netlify will not try to deploy functions from the default functions directory.
What if I’m using the SITE_BASE_DIRECTORY/netlify/
path for something else?
We recommend you change the name of this directory, as it could cause build failures or other unpredictable issues now or in the future. To prevent issues as a result of this change, we posted an advance notice back in December. We also print a warning message in the deploy logs if we detect the path in your site’s base directory.
What else does zero-config deployment enable?
Glad you asked! Having a default functions folder makes it possible for Build Plugins to create and deploy functions for a site. We’re using this functionality now in the Next on Netlify plugin, and we’ll be posting a tutorial soon to show you how to do this with your own plugins.
Until then, keep on building! We’ll keep working on helping you build better and faster.