Skip to content

[BUG] wrangler.jsonc vars not respected when .env.local is present. #766

Open
@mez

Description

@mez

Describe the bug

in my .env.local
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=...

in my wrangler.jsonc
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=...

when it runs next build it uses the .env.local but it wasn't overriding with the var in wrangler.jsonc. What am I doing wrong? I got it to work by temp renaming .env.local file to something else and then doing the deploy.

Steps to reproduce

  1. Have a next js frontend facing var.
  2. override in wrangler.jsonc
  3. do a log in a deployed worker and you'll see the local var not the deployed var.

Expected behavior

I expect the wrangler.jsonc var to be the used var in prod

@opennextjs/cloudflare version

1.4.0

Wrangler version

4.23.0

next info output

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:15 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6000
  Available memory (MB): 65536
  Available CPU cores: 10
Binaries:
  Node: 23.11.0
  npm: 10.9.2
  Yarn: 1.22.19
  pnpm: 9.9.0
Relevant Packages:
  next: 15.3.3 // There is a newer version (15.3.5) available, upgrade recommended! 
  eslint-config-next: 15.3.3
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.8.3
Next.js Config:
  output: N/A
 ⚠ There is a newer version (15.3.5) available, upgrade recommended! 
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions