Wednesday, May 24th 2023
More flexible Environment Variables in Edge Functions and Middleware
![](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Fcontentful%2Fimage%2Fe5382hct74si%2F7GtVafdpAtp8o9DQ1YZ3g8%2F7a80cdef13db0ee2f011b2de86874c6e%2Fenv_vars_-_Light.png&w=3840&q=95&dpl=dpl_E2GZsUUM4EyvuYCes3krYpYUWFdo)
![](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Fcontentful%2Fimage%2Fe5382hct74si%2F42nzntoEWvpXx9RNOcaB46%2Fe48099813fbd7f73f4ed5af914b8836a%2Fenv_vars_-_Dark.png&w=3840&q=95&dpl=dpl_E2GZsUUM4EyvuYCes3krYpYUWFdo)
Posted by
![](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Fcontentful%2Fimage%2Fe5382hct74si%2F7GtVafdpAtp8o9DQ1YZ3g8%2F7a80cdef13db0ee2f011b2de86874c6e%2Fenv_vars_-_Light.png&w=3840&q=95&dpl=dpl_E2GZsUUM4EyvuYCes3krYpYUWFdo)
![](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Fcontentful%2Fimage%2Fe5382hct74si%2F42nzntoEWvpXx9RNOcaB46%2Fe48099813fbd7f73f4ed5af914b8836a%2Fenv_vars_-_Dark.png&w=3840&q=95&dpl=dpl_E2GZsUUM4EyvuYCes3krYpYUWFdo)
You now have more flexible access and improved limits for environment variables from Edge Functions and Middleware:
- The max environment variable size is now 64KB instead of 5KB, same as Serverless Functions.
- Other than the reserved names, there are no additional restrictions to name environment variables.
- Accessing
process.env
is no longer restricted to be statically analyzable. This means that, for example, you can now compute variable names such asprocess.env[`${PREFIX}_SECRET`]
.
Check out the documentation to learn more.