Netlify Functions and Env Variables from netlify.toml

Thanks for sharing, @Matheswaaran. For other finding this guide, please note the 4K environment variable limit is part of the underlying infrastructure Functions uses (which is AWS Lambda):

https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html

The limitation is listed on the page above, which is quoted below:

The following quotas apply to function configuration, deployments, and execution. They cannot be changed.

Resource Quota
Function memory allocation 128 MB to 10,240 MB, in 1-MB increments.
Function timeout 900 seconds (15 minutes)
Function environment variables 4 KB

Note, Netlify’s limitations can be more restrictive than those above. For example, the maximum function timeout is 28 seconds with a default of 10 seconds (with background functions being an exception).

However, we cannot offer a larger space for environment variables because of the limitation above.

1 Like

Posting here as well in case some wonder: netlify-plugin-inline-functions-env-typescript - npm inlineAll param, it might be what you need.

Tried Netlify functions again after three years and it’s a huge bummer this is something given no priority. I love Netlify for so many reasons, but this makes the functions feature feel not ready for the big time. I hit this issue (Figuring out if netlify-function is in a main env or production deploy) years go and ended up moving to Vercel.

That’s an unfortunate stance to take for something like this because it’s something that could easily be documented. People with more than 4kb can opt into to using the UI or resorting to sed if needed. Moreover, even for that use case they’d still like to know what environment they’re targeting I’m sure. I use Netlify because of the branch deploys and branch based environments which is all but broken without nasty hacks.

Voicing this as one of the “few” to even the scales compared to the “many.” :grinning:

hi there mwood23,

we do appreciate your feedback on this, and we hope to get things fixed up better when we can. I know there is an update to our doc re: env vars planned, and generally of course it would be better to have more than a 4kb limit, but i do believe that is still out of our hands.

if anything changes here, we will absolutely let you know.