Closed davimarcilio closed 2 months ago
Failed to reproduce, please reopen with reproduction:
![Uploading CleanShot 2024-04-22 at 10.02.21@2x.png…]()
The application fails when a required environment variable is set to an empty value, for example:
NEXT_PUBLIC_MY_PUBLIC_KEY=
This issue arises with the current Zod schema validation in env.ts
:
NEXT_PUBLIC_MY_PUBLIC_KEY: z.string()
To resolve this, update the schema to allow optional values:
z.string().optional()
It was working before nextjs v14.2
We have our emptyStringAsUndefined
option - maybe Next decided to do something similar, idk
In my case, everything was working when the version was lower than 14.2, after updating it stopped working, I did several tests to try to solve it but the only solution was to return the version
It's not working in the new version of next 14.2.2, I had to downgrade to version 14.1.0 to be able to use it