To use environment variables in your Netlify Functions, access the process.env variable:


You can use object destructuring at the beginning of your JS file, to make the code nicer:

const { YOUR_VARIABLE } = process.env;

so you can just use YOUR_VARIABLE in the rest of the program.

You set the variables through the Netlify administration interface (you can also add them in your repo, but I’d recommend using the Netlify UI so you have no secrets in your Git repository).

Coming soon:
Click to find out more โคด๏ธ