When using SKIP_ENV_VALIDATION=true with @t3-oss/env-nextjs, the entire Zod validation process is skipped. This is useful for scenarios like Docker builds, but it introduces an unexpected side effect: default values specified in the Zod schema are not applied.
This behavior can lead to undefined environment variables where default values were expected, potentially causing buildtime errors or unexpected behavior in the application.
Current Behavior
When SKIP_ENV_VALIDATION=true, all Zod validations are bypassed.
Default values specified in the Zod schema (e.g., .default("development")) are not applied.
Environment variables without a value remain undefined instead of using their specified defaults.
Expected Behavior
Even when skipping full validation:
Default values specified in the Zod schema should be applied.
Basic type coercion (e.g., z.coerce.number()) should still occur.
The application should be able to run with a minimal set of required environment variables.
Description
When using
SKIP_ENV_VALIDATION=true
with@t3-oss/env-nextjs
, the entire Zod validation process is skipped. This is useful for scenarios like Docker builds, but it introduces an unexpected side effect: default values specified in the Zod schema are not applied.This behavior can lead to undefined environment variables where default values were expected, potentially causing buildtime errors or unexpected behavior in the application.
Current Behavior
SKIP_ENV_VALIDATION=true
, all Zod validations are bypassed..default("development")
) are not applied.Expected Behavior
Even when skipping full validation:
z.coerce.number()
) should still occur.