You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can accidentally include one of your public environment variables in the server object, preventing you from accessing it on the client even though it is public. There should probably be an error if the server variable section has a public prefix, to prevent this from happening.
For example, this env in NextJS:
export const env = createEnv({
server: {
DATABASE_URL: z.string().url(),
NEXT_PUBLIC_API_KEY: z.string().min(1),
// ^^^^^^^^^^^^ ideally, this should be an error
},
client: {
NEXT_PUBLIC_OTHER_VARIABLE: z.string().url(),
},
runtimeEnv: { ... },
});
Not sure how big of an issue this is but it seems like a good and fairly easy fix. I can send a PR if it would be helpful.
The text was updated successfully, but these errors were encountered:
I think it might still be good as a warning if people do it accidentally, because if you make this mistake you won't be able to access your environment variables on the client-side.
I think it might still be good as a warning if people do it accidentally, because if you make this mistake you won't be able to access your environment variables on the client-side.
You can accidentally include one of your public environment variables in the
server
object, preventing you from accessing it on the client even though it is public. There should probably be an error if the server variable section has a public prefix, to prevent this from happening.For example, this
env
in NextJS:Not sure how big of an issue this is but it seems like a good and fairly easy fix. I can send a PR if it would be helpful.
The text was updated successfully, but these errors were encountered: