-
-
Notifications
You must be signed in to change notification settings - Fork 112
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Say I have a common env config, and one specific to a Next.js site in my monorepo:
const common = createEnv({
shared: {
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
},
experimental__runtimeEnv: {
NODE_ENV: process.env.NODE_ENV,
},
})
const siteEnv = createEnv({
extends: [common],
// Assume other variables here...
})If I now try and use that shared NODE_ENV variable from my siteEnv config like siteEnv.NODE_ENV on the client side, t3-env will throw the Attempted to access a server-side environment variable on the client error, as I assume the proxy used to detect this doesn't take into account configs in the extends option when checking shared.shape:
t3-env/packages/core/src/index.ts
Lines 276 to 279 in 5975abe
| const isServerAccess = (prop: string) => { | |
| if (!opts.clientPrefix) return true; | |
| return !prop.startsWith(opts.clientPrefix) && !(prop in shared.shape); | |
| }; |
nx-kevinbischof, Telos8840, chertik77, anyuj and ImBIOS
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working