Skip to content

celld dev does not read .env, but wrangler dev reads it when there is no .dev.vars #243

Closed

Description

@kayue

In v0.6.0, celld dev reads Worker variables only from .dev.vars beside the config. It does not read .env:

celld/crates/celld/dev.rs

Lines 484 to 492 in bad4649

/// The Worker variables of `.dev.vars` beside the config, in the dotenv form
/// `wrangler dev` reads. They override the `vars` of the config. Only
/// `celld dev` reads the file, so a local credential cannot reach a fleet.
#[allow(clippy::disallowed_methods)] // The project is on the operator's host filesystem.
fn read_dev_vars(config: &Path) -> anyhow::Result<BTreeMap<String, String>> {
let path = config.with_file_name(".dev.vars");
if !path.exists() {
return Ok(BTreeMap::new());
}

wrangler dev reads .dev.vars first. When there is no .dev.vars, it reads .env and then .env.local from the same directory (getVarsForDev). The Cloudflare docs give both files for local development:

Put secrets for use in local development in either a .dev.vars file or a .env file, in the same directory as the Wrangler configuration file.

docs/README.md says that the command reads .dev.vars "as wrangler dev does", and the help of celld dev says the same. But a project that keeps its local variables in .env gets none of them under celld dev. Each one is undefined in the Worker, and celld gives no warning.

Repro

wrangler.jsonc:

{
  "name": "dotenv-repro",
  "main": "index.js",
  "compatibility_date": "2026-09-26"
}

index.js:

export default {
  fetch(request, env) {
    return Response.json({ GREETING: env.GREETING ?? null });
  },
};
echo 'GREETING=hello' > .env
celld dev
curl http://127.0.0.1:9876/
  • Expected, as with wrangler dev: {"GREETING":"hello"}
  • Actual: {"GREETING":null}

With the same line in .dev.vars instead, the response is {"GREETING":"hello"}.

celld 0.6.0, macOS arm64.

Activity

  1. added 2 commits that reference this issue on Oct 7, 2026
  2. bartlomieju commented on Oct 7, 2026

    @bartlomieju
    Member

    Fixed in v0.6.2: celld dev reads .env and .env.local when there is no .dev.vars, as wrangler dev does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions