Replies: 6 comments 5 replies
-
I just reached this limit too. I tried putting it in secrets but got the same error message there so it seems the limit still applies. I haven't seen any reasoning behind the seemingly arbitrary 4 KB number so this just feels like really bad developer experience. One workaround could be to encrypt the values and put the encrypted values in the code and the keys in the environment variables, but come on... |
Beta Was this translation helpful? Give feedback.
-
bump on this discussion. |
Beta Was this translation helpful? Give feedback.
-
The limit is unfortunately, due to AWS. We do have a Support Article for this → https://vercel.com/support/articles/how-do-i-workaround-vercel-s-4-kb-environment-variables-limit. |
Beta Was this translation helpful? Give feedback.
-
The support article only makes it easy to do this with a next.js project, where its easy to add an api route to the project. Can we not build the solution mentioned in this article, into the Vercel UI somehow? This would make things very convenient. |
Beta Was this translation helpful? Give feedback.
-
Vercel has the 4kb limit because of the underlying limitation on AWS Lambda. They have detailed a workaround but it doesn't seem like a good solution for all use cases (as it relies on manual work and api calls for fetching envs). They say in a tweet that they are working on it. In the meantime, one option is to use an external secrets manager (like Doppler), and fetch secrets and serialize to // package.json
"scripts": {
...
"build": "fetch-secrets-to-env && npm run build",
} As long as Another option, is to do this 👆 but add some security by encrypting all values and decrypting in runtime. I wrote a blog post about this approach and made a working example repo. |
Beta Was this translation helpful? Give feedback.
-
Hi there! Wanted to update you on this issue. The limit has now been increased to 64KB. Here is the changelog |
Beta Was this translation helpful? Give feedback.
-
_Edit: This has shipped https://github.com/orgs/vercel/discussions/207#discussioncomment-3360373
The size limit on environment variables is too small when you have several public/private pem keys stored in your environment variables. Is there any way around this?
I've tried storing the keys in secrets instead of env vars but it doesn't seem like secrets can be assigned separately to production/preview/development environments, so this doesn't really work for my purposes.
It would be great if this size limitation could be removed or at least increased to accomodate larger environment variables. If anyone has a good workaround please let me know.
Beta Was this translation helpful? Give feedback.
All reactions