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
The behavior of the clientPrefix parameter in the @t3-oss/env-core library has changed, causing unexpected errors.
Example
import{createEnv}from'@t3-oss/env-core'import{z}from'zod'constenv=createEnv({isServer: false,clientPrefix: '',client: {FOO: z.string(),},runtimeEnvStrict: {FOO: 'FOO',},})console.log(env.FOO)// Throws error after upgrading to v0.9
In version 0.8, the provided code was functioning correctly. However, after upgrading to version 0.9, executing the same code results in the following error:
Attempted to access a server-side environment variable on the client
The text was updated successfully, but these errors were encountered:
DanSnow
changed the title
Behavior Change in clientPrefix Parameter
Behavior Change when clientPrefix is empty
Feb 16, 2024
I'm running into same issue and using shared doesn't work. I see that there is this code in source
const isServerAccess = (prop)=>{
if (!opts.clientPrefix)
return true;
return !prop.startsWith(opts.clientPrefix) && !(prop in shared.shape);
}
So it means that if we have clientPrefix: '' it will never be accessible on client? I'm always getting the Attempted to access a server-side environment variable on the client if I put the variables in shared, isServerAccess always returns true, even on client
Issue Description
The behavior of the
clientPrefix
parameter in the@t3-oss/env-core
library has changed, causing unexpected errors.Example
In version 0.8, the provided code was functioning correctly. However, after upgrading to version 0.9, executing the same code results in the following error:
The text was updated successfully, but these errors were encountered: