Skip to content

🐛 BUG: no environment found in configuration #8701

Description

@cazcik

Which Cloudflare product(s) does this pertain to?

Wrangler

What versions are you using?

4.5.0

What operating system and version are you using?

macOS Sequoia 15.3.1

Please provide a link to a minimal reproduction

No response

Describe the Bug

wrangler deploy is having trouble when passing --env stating the env does not exist even though it is described in wrangler.jsonc.

the deploy still completes however since it was unable to find the specified environment it does not get pushed with the corresponding environment's config.

wrangler.jsonc

{
  "$schema": "./node_modules/wrangler/config-schema.json",
  "name": "myapp",
  "main": "./workers/app.ts",
  "compatibility_date": "2025-03-26",
  "compatibility_flags": ["nodejs_compat"],
  "upload_source_maps": true,
  "assets": {
    "directory": "./build/client",
  },
  "observability": {
    "enabled": true,
  },
  "env": {
    "development": {
      "vars": {
        "ENVIRONMENT": "development",
      },
    },
    "production": {
      "vars": {
        "ENVIRONMENT": "production",
      },
    },
  },
}

deploy command

pnpm wrangler deploy --env development

wrangler output

 ⛅️ wrangler 4.5.0
------------------

Using redirected Wrangler configuration.
 - Configuration being used: "build/server/wrangler.json"
 - Original user's configuration: "wrangler.jsonc"
 - Deploy configuration file: ".wrangler/deploy/config.json"
▲ [WARNING] Processing build/server/wrangler.json configuration:

    - No environment found in configuration with name "development".
      Before using `--env=development` there should be an equivalent environment section in the
  configuration.
  
      Consider adding an environment configuration section to the wrangler.json file:
      ```
      [env.development]
      ```
  


Attaching additional modules:
┌─────────────────────────────────┬──────┬─────────────┐
│ Name                            │ Type │ Size        │
├─────────────────────────────────┼──────┼─────────────┤
│ assets/app-DcVQ_KQR.js          │ esm  │ 284.51 KiB  │
├─────────────────────────────────┼──────┼─────────────┤
│ assets/server-build-6hK1RppR.js │ esm  │ 1080.95 KiB │
├─────────────────────────────────┼──────┼─────────────┤
│ Total (2 modules)               │      │ 1365.45 KiB │
└─────────────────────────────────┴──────┴─────────────┘
🌀 Building list of assets...
🌀 Starting asset upload...
🌀 Found 8 new or modified static assets to upload. Proceeding with upload...
+ /.gitkeep
+ /assets/manifest-0a33de6d.js
+ /assets/chunk-GNGMS2XR-eXYBZ-pF.js
+ /assets/home-Car_vtk_.js
+ /assets/root-wo9MWzK3.js
+ /assets/entry.client-FMuzxyuH.js
+ /assets/with-props-DeHwp1uX.js
+ /assets/root-B1ryitOf.css
Uploaded 2 of 8 assets
Uploaded 5 of 8 assets
Uploaded 8 of 8 assets
✨ Success! Uploaded 8 files (1.51 sec)

Total Upload: 1365.57 KiB / gzip: 266.50 KiB
Worker Startup Time: 11 ms
No bindings found.
Uploaded myapp-development (7.10 sec)
Deployed myapp-development triggers (0.70 sec)
  https://myapp.myworker.workers.dev
Current Version ID: a7a3741e-e96e-4238-9155-62e8d95bfc84

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    package:vite-pluginRelating to the `@cloudflare/vite-plugin` package

    Type

    No type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions