Skip to main content
Mar 8, 2026 2:53 PM UTC
Question

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!

6 replies

1Password Employee
Apr 13, 2026 10:30 PM UTC

Hey Cellulosa! My apologies for the delayed response here! Thanks for asking - I'll check in with the team to see if they have any suggestions for using our new Environments feature with mounted local .env files and report back with what I learn. 

theo
Apr 16, 2026 4:25 PM UTC

You can probably work around this using varlock (https://varlock.dev)

There is a 1Password plugin to load data from either specific items or environments, and you can wire up your bun app to load your config without a mounted .env file.

cellulosaAuthor
Apr 16, 2026 6:33 PM UTC

well if I have to run

varlock run  -- 

I might run directly

op run --

 

theo
Apr 16, 2026 6:55 PM UTC

my bad - I missed the note on that docs page! Regardless check it out, you might like it - especially in JS-based projects and monorepos.