fix: auto-detect Bun runtime when not explicitly set in trigger.config.ts#3239
fix: auto-detect Bun runtime when not explicitly set in trigger.config.ts#3239abhay0132 wants to merge 1 commit intotriggerdotdev:mainfrom
Conversation
|
|
Hi @abhay0132, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can generate a title for your PR based on the changes.Add |
| const detectedRuntime: BuildRuntime = typeof process.versions.bun === "string" ? "bun" : "node"; | ||
| const defaultRuntime: BuildRuntime = config.runtime ?? detectedRuntime; |
There was a problem hiding this comment.
🚩 Behavioral change: deploy from Bun CLI will now default to Bun runtime in production images
Previously the default runtime was always "node" (since run_engine_v2 was unconditionally forced true at packages/cli-v3/src/config.ts:191). Now, if a user runs trigger deploy from a Bun process without explicitly setting runtime in their trigger.config.ts, the deployed Docker image will use the Bun runtime. This is intentional per the commit message ("detect Bun runtime automatically when not explicitly configured"), but it's a meaningful behavioral change for users who happen to use Bun as their local shell/script runner but don't intend for their deployed tasks to run under Bun (which is marked as experimental per packages/cli-v3/src/config.ts:351-356). The bun experimental warning at line 351-356 only fires when config.runtime === "bun" is explicitly set in the config file, so auto-detected Bun will skip the warning.
Was this helpful? React with 👍 or 👎 to provide feedback.
Fixes #3105
Problem
When a user runs their project with Bun (e.g. via a pre-build command like
bun run build) but does not explicitly setruntime: "bun"in theirtrigger.config.ts, the deployment UI incorrectly shows "Node.js" as the runtime.
This happened because the default runtime was hardcoded to "node" regardless
of what runtime was actually executing the process.
Fix
Auto-detect the runtime by checking
process.versions.bunat config resolutiontime. If Bun is detected and the user has not explicitly set a runtime in their
config, we now correctly default to "bun" instead of "node".
The explicit user config always takes priority — this only affects the fallback.
Changes
packages/cli-v3/src/config.ts: replaced hardcoded"node"default withruntime auto-detection using
process.versions.bun