Infisical hangs indefinitely when executing any Bun v1.2.9 command
Describe the bug
When using infisical run to execute any Bun command, the process hangs indefinitely. This happens regardless of whether it's a direct Bun command or through script chaining.
To Reproduce
Steps to reproduce the behavior:
- Set up a project with infisical
- Create test scripts in package.json:
{
"scripts": {
"test1": "infisical run -- bun --version",
"test2": "infisical run -- echo 'hello'",
"test3": "infisical run --command 'bun --version'",
"test4": "bun with-env echo 'test with-env'"
}
}
- Run the scripts:
# These hang indefinitely:
bun test1 # Using -- with bun command
bun test3 # Using --command with bun command
bun test4 # Using script chaining with bun
# This works fine:
bun test2 # Using infisical with non-bun command
Expected behavior
Any command run through infisical should:
- Execute normally, whether it's a Bun command or not
- Show output from the command
- Complete execution
- Exit normally
Platform you are having the issue on:
- OS: macOS 14.7.4
- Bun version: 1.2.9
- Infisical version: 0.39.1
Additional context
- This issue affects ANY usage of Bun commands through infisical
- The command hangs without any error message or output
- The process needs to be manually killed with Ctrl+C
- Non-Bun commands work fine through infisical
- The same Bun commands work fine when not run through infisical
- The issue occurs with both the
--delimiter and--commandflag approaches
Workarounds
- Use bun 1.2.8
or
- Use npm/yarn/pnpm:
# All of these work:
pnpm test1 # Using -- with bun command
pnpm test3 # Using --command with bun command
pnpm test4 # Using script chaining with bun
pnpm test2 # Using infisical with non-bun command
- Avoid using Bun commands through infisical entirely if possible
- Use direct shell commands instead of Bun where possible
Hey Seawatts,
I tried to recreate this issue but everything seems to work fine for me.
OS: macOS 15.3.2 Bun version: 1.2.9 Infisical version: 0.39.1
I tried this in several terminals and used both new and old versions for both Infisical and Bun. I also tried this on two different Infisical projects, one that contained a few secrets and one that didn't. In all instances everything worked fine.
Try to run your commands with --log-level trace and it'll output debug information. Here's the full command:
infisical run --log-level trace -- bun --version
Thanks for the prompt response @x032205, and through reproduction. However, I'm still seeing the same issue.
Here is my output with log level trace. The execution hangs after that. NOTE: I removed the full path and variables here.
bun test3
$ infisical run --log-level trace -- bun --version
12:39PM DBG FindWorkspaceConfigFile: workspace file found at [path=.infisical.json]
12:39PM DBG GetEnvelopmentBasedOnGitBranch: [envBasedOnGitBranch=] [ok=false]
12:39PM DBG getEnvelopmentBasedOnGitBranch: [err=%!s(<nil>)]
12:39PM DBG FindWorkspaceConfigFile: workspace file found at [path=.infisical.json]
12:39PM DBG FindWorkspaceConfigFile: workspace file found at [path=.infisical.json]
12:39PM DBG GetAllEnvironmentVariables: Trying to fetch secrets using logged in details
12:39PM DBG GetAllEnvironmentVariables: Connected to Infisical instance, checking logged in creds
12:39PM DBG FindWorkspaceConfigFile: workspace file found at [path=.infisical.json]
12:39PM DBG GetAllEnvironmentVariables: Trying to fetch secrets JTW token [err=%!s(<nil>)]
12:39PM DBG injecting the following environment variables into shell: [XXXXXXX]
12:39PM INF Injecting 32 Infisical secrets into your application process
12:39PM DBG executing command: /bin/zsh -c bun --version
// .infisical.json
{
"workspaceId": "XXXX",
"defaultEnvironment": "",
"gitBranchToEnvironmentMapping": null
}
Extra context, I am logged into two different users with Infisical, so I am running infisical user switch to select the account before running that command. Not sure if that would matter here.
Separate note, it would be cool to be able to have the cli just know which account it needs to use for that workspace instead of me having to type user switch each time I go back and forth between projects, which is multiple times a day.
Could you try just running /bin/zsh -c 'bun --version'? This could help us figure out if the issue is with your shell or not.
% /bin/zsh -c 'bun --version'
1.2.9
I found repro steps:
- Install a new package with
bun add xor update the dependencies withbun update - Try to run the commands above. This will hang still.
- Remove node_modules and run
bun install - Run the commands above and it works.