Skip to main content
March 8, 2026
Question

Bun cannot read 1Password-mounted .env files directly

  • March 8, 2026
  • 2 replies
  • 154 views

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!

2 replies

1Password Employee
April 13, 2026

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
April 16, 2026

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
April 16, 2026

well if I have to run

varlock run  -- 

I might run directly

op run --

 

theo
April 16, 2026

There are a bunch of drop in integrations so in many cases you dont run it that way.  Also op run doesnt work with environments. Tons of other features as well, its a full toolkit to deal with config. Loading from 1pass is just one small part of it. But I thought I'd mention because it solves your specific problem of loading environments secrets into a bun app.