Skip to content

fix: default NODE_ENV to "development" and override in production env#146

Merged
mahata merged 1 commit intomainfrom
fix/node-env-default-development
Mar 26, 2026
Merged

fix: default NODE_ENV to "development" and override in production env#146
mahata merged 1 commit intomainfrom
fix/node-env-default-development

Conversation

@mahata
Copy link
Copy Markdown
Owner

@mahata mahata commented Mar 26, 2026

Summary

  • Changes the top-level [vars] in wrangler.toml to default NODE_ENV to "development" (used by wrangler dev during local development).
  • Adds an [env.production.vars] block that overrides NODE_ENV to "production" for wrangler deploy --env production.
  • Removes the now-redundant --var NODE_ENV:development flag from the Playwright webServer command in playwright.config.ts.

The top-level [vars] in wrangler.toml now defaults NODE_ENV to
"development" for local dev (wrangler dev), while a new
[env.production.vars] block sets it to "production" for deploys
via `wrangler deploy --env production`.

Also removes the now-redundant --var NODE_ENV:development flag
from the Playwright webServer command.
Copilot AI review requested due to automatic review settings March 26, 2026 22:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts Cloudflare Workers environment variable defaults so local development (wrangler dev) runs with development semantics by default, while production deployments can explicitly override to production behavior.

Changes:

  • Default NODE_ENV to "development" in wrangler.toml [vars].
  • Add [env.production.vars] to override NODE_ENV to "production".
  • Remove the Playwright webServer wrangler dev --var NODE_ENV:development flag, relying on wrangler.toml defaults.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
wrangler.toml Sets default NODE_ENV to development and adds a production override block.
playwright.config.ts Simplifies wrangler dev invocation by removing the explicit NODE_ENV var flag.

Comment thread wrangler.toml
new_sqlite_classes = ["ChatRoom"]

[vars]
NODE_ENV = "development"
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting the top-level [vars] NODE_ENV to "development" makes the default Wrangler environment (used by wrangler deploy with no --env) run with development settings. Since the repo’s deploy flow is pnpm deploywrangler deploy (no --env production), this change can unintentionally deploy a production worker with NODE_ENV=development (e.g., session cookies not marked secure, dev/test-only endpoints enabled). Consider keeping the default environment as production-safe and using a dedicated dev/e2e env (or .dev.vars) to set NODE_ENV=development, or ensure all deploy commands/docs use --env production.

Suggested change
NODE_ENV = "development"
NODE_ENV = "production"

Copilot uses AI. Check for mistakes.
@mahata mahata merged commit a523201 into main Mar 26, 2026
7 checks passed
@mahata mahata deleted the fix/node-env-default-development branch March 26, 2026 22:21
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

Successfully merging this pull request may close these issues.

2 participants