Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default values skipped when using SKIP_ENV_VALIDATION #266

Open
iFlyinq opened this issue Sep 12, 2024 · 0 comments
Open

Default values skipped when using SKIP_ENV_VALIDATION #266

iFlyinq opened this issue Sep 12, 2024 · 0 comments

Comments

@iFlyinq
Copy link

iFlyinq commented Sep 12, 2024

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

  1. When SKIP_ENV_VALIDATION=true, all Zod validations are bypassed.
  2. Default values specified in the Zod schema (e.g., .default("development")) are not applied.
  3. Environment variables without a value remain undefined instead of using their specified defaults.

Expected Behavior

Even when skipping full validation:

  1. Default values specified in the Zod schema should be applied.
  2. Basic type coercion (e.g., z.coerce.number()) should still occur.
  3. The application should be able to run with a minimal set of required environment variables.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant