#Bun "strips" environment variables loaded from a .env file

1 messages · Page 1 of 1 (latest)

signal mason
#

Hi, I noticed that using Bun, a enviroment variable will not show fully, like ig its "stripping" the content of it.
I've build a small JS file to test this, and this is the result:
The .env file contains a entry called VRC_PASSWORD, and for this example, this is its content (its not a real password):
VRC_PASSWORD="Normal$SHOULDSHOW@NormalAgain"
When running console.log(process.env.VRC_PASSWORD); in NodeJS LITS 20, the output is:
Normal$SHOULDSHOW@NormalAgain, which is normal.
When running with Bun, the result is:
Normal@NormalAgain. Everything after the $ is getting cut until the @ character.

#

I also tried without the double quotes and single quotes, still the same results

pure spindle
#

can you try to escape the $

#

(i have no idea if it will work on node one tho)

signal mason
pure spindle
#

so sounds like bun is being too much more fancy 😭

#

which is nice to be fancy, but it means node is less happy

heady kettle
#

can you try wrapping the env var in quotes

#

like FOO="bar"