mirror of
https://github.com/baptisteArno/typebot.io.git
synced 2026-06-13 21:02:56 +08:00
🧑💻 Improve invalid environment variable insight on build fail
This commit is contained in:
parent
bf051bebde
commit
8b8a23accb
11
packages/env/env.ts
vendored
11
packages/env/env.ts
vendored
@ -325,6 +325,17 @@ export const env = createEnv({
|
||||
...posthogEnv.runtimeEnv,
|
||||
},
|
||||
skipValidation: typeof window !== 'undefined' && window.__ENV === undefined,
|
||||
onValidationError(error) {
|
||||
console.error(
|
||||
'❌ Invalid environment variables:',
|
||||
error.flatten().fieldErrors
|
||||
)
|
||||
throw new Error(
|
||||
`Invalid environment variables: ${JSON.stringify(
|
||||
error.flatten().fieldErrors
|
||||
)}`
|
||||
)
|
||||
},
|
||||
onInvalidAccess: (variable: string) => {
|
||||
throw new Error(
|
||||
`❌ Attempted to access a server-side environment variable on the client: ${variable}`
|
||||
|
||||
Loading…
Reference in New Issue
Block a user