Skip to content

Problem with wrangler version 4 and deploying Pages  #8851

Description

@ninjasitm

Which Cloudflare product(s) does this pertain to?

Wrangler

What versions & operating system are you using?

Not working = Wrangler 4.x, Node 18.20.6, Nuxt 3.16.1, Working = Wrangler 3.114.1

Please provide a link to a minimal reproduction

No response

Describe the Bug

Hello,

I'm experiencing this issue with a NUXT project:

Using redirected Wrangler configuration.
 - Configuration being used: "_worker.js/wrangler.json"
 - Original user's configuration: "../wrangler.toml"
 - Deploy configuration file: "../.wrangler/deploy/config.json"

✘ [ERROR] Processing _worker.js/wrangler.json configuration:

    - You have specified the environment "production", but are using a redirected configuration,
  produced by a build tool such as Vite.
      You need to set the environment in your build tool, rather than via Wrangler.
      For example, if you are using Vite, refer to these docs:
  https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/

I've used the following commands:

 CLOUDFLARE_ENV=production npx nuxt build
 CLOUDFLARE_ENV=production npx wrangler pages deploy

And here's my wrangler.toml file:

# For more details on how to configure Wrangler, refer to:
# https://developers.cloudflare.com/workers/wrangler/configuration/

name = "---"
compatibility_date = "2025-03-27"
pages_build_output_dir = "./dist"
compatibility_flags = ["nodejs_compat"]

[observability]
enabled = true

# Smart Placement
# Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement
[placement]
mode = "smart"

# Bindings
# Bindings allow your Worker to interact with resources on the Cloudflare Developer Platform, including
# databases, object storage, AI inference, real-time communication and more.
# https://developers.cloudflare.com/workers/runtime-apis/bindings/

[[r2_buckets]]
binding = "R2"
bucket_name = "---"

[[kv_namespaces]]
binding = "KV"
id = "nitm-connections"

[queues]
[[queues.producers]]
binding = "QUEUE"
queue = "---"

The build is successful until the error above during wrangler deploy. Any help here? I've followed the documentation and tried deploying with he env variable prexing the command but no success.

If I downgrade to Wraangler V3 then my deploy works.

Please provide any relevant error logs

Using redirected Wrangler configuration.
 - Configuration being used: "_worker.js/wrangler.json"
 - Original user's configuration: "../wrangler.toml"
 - Deploy configuration file: "../.wrangler/deploy/config.json"

✘ [ERROR] Processing _worker.js/wrangler.json configuration:

    - You have specified the environment "production", but are using a redirected configuration,
  produced by a build tool such as Vite.
      You need to set the environment in your build tool, rather than via Wrangler.
      For example, if you are using Vite, refer to these docs:
  https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions