Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: .env file missing error when none exists and WRANGLER_LOG="debug" #7042

Open
irvinebroque opened this issue Oct 21, 2024 · 0 comments
Labels
bug Something that isn't working

Comments

@irvinebroque
Copy link
Contributor

irvinebroque commented Oct 21, 2024

Which Cloudflare product(s) does this pertain to?

Wrangler

What version(s) of the tool(s) are you using?

3.81.0

What version of Node are you using?

22

What operating system and version are you using?

Mac Sonoma 14.6

Describe the Bug

If I set export WRANGLER_LOG=debug and then deploy a Worker, and there is no .env file in the cwd, I get this error in my logs:

>  export WRANGLER_LOG=debug 
>  npx wrangler@latest deploy
🪵  Writing logs to "/Users/brendan/.wrangler/logs/wrangler-2024-10-21_15-25-39_001.log"
Failed to load .env file ".env": Error: ENOENT: no such file or directory, open '.env'
    at Object.openSync (node:fs:573:18)
    at Object.readFileSync (node:fs:452:35)
    at tryLoadDotEnv (/Users/brendan/.npm/_npx/d77349f55c2be1c0/node_modules/wrangler/wrangler-dist/cli.js:163894:72)
    at loadDotEnv (/Users/brendan/.npm/_npx/d77349f55c2be1c0/node_modules/wrangler/wrangler-dist/cli.js:163903:12)
    at /Users/brendan/.npm/_npx/d77349f55c2be1c0/node_modules/wrangler/wrangler-dist/cli.js:214085:20
    at /Users/brendan/.npm/_npx/d77349f55c2be1c0/node_modules/wrangler/wrangler-dist/cli.js:179349:16
    at maybeAsyncResult (/Users/brendan/.npm/_npx/d77349f55c2be1c0/node_modules/wrangler/wrangler-dist/cli.js:177570:44)
    at /Users/brendan/.npm/_npx/d77349f55c2be1c0/node_modules/wrangler/wrangler-dist/cli.js:179348:14
    at /Users/brendan/.npm/_npx/d77349f55c2be1c0/node_modules/wrangler/wrangler-dist/cli.js:177557:22
    at Array.reduce (<anonymous>) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '.env'
}

This is misleading since it's not actually a problem, we are just trying to load .env and swallowing the error (except when you turn on WRANGLER_LOG=debug.

Even when debug logs are on, this seems like an expected scenario not something that should error with a stacktrace?

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

@irvinebroque irvinebroque added the bug Something that isn't working label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
Projects
Status: Untriaged
Development

No branches or pull requests

1 participant