Forum Discussion

cellulosa's avatar
cellulosa
New Member
21 hours ago

Bun cannot read 1Password-mounted .env files directly

Hi everyone,

I’m experimenting with 1Password Local Environment Files for local development, but I ran into an issue when using Bun. Even though I can cat .env and see the correct contents, running:

bun --print process.env

returns nothing — Bun does not pick up any of the variables. After some testing, I found that copying the content into a normal file makes it work:

cp .env .env.development
bun --print process.env

The problem seems to be that Bun cannot reliably read virtual/mounted files (pipes/FUSE mounts). Workarounds that work:

  • Use dotenv/x and use `dotenvx run -- bun run ...`
  • Use `op run --environment -- bun run ...`

Since https://bun.com/docs/runtime/environment-variables, it should just work with the mounted file, whereas these approaches result in adding extra commands or wrappers all around the monorepo.

It would be great if 1Password could provide guidance on using Bun (or other tools that expect standard filesystem .env files) with mounted local env files.

Has anyone else run into this with Bun or similar tools?

Thanks!

No RepliesBe the first to reply