Skip to content

fix: auto-detect Bun runtime when not explicitly set in trigger.config.ts#3239

Closed
abhay0132 wants to merge 1 commit intotriggerdotdev:mainfrom
abhay0132:fix/bun-runtime-detection
Closed

fix: auto-detect Bun runtime when not explicitly set in trigger.config.ts#3239
abhay0132 wants to merge 1 commit intotriggerdotdev:mainfrom
abhay0132:fix/bun-runtime-detection

Conversation

@abhay0132
Copy link

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 set runtime: "bun" in their
trigger.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.bun at config resolution
time. 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 with
    runtime auto-detection using process.versions.bun

@changeset-bot
Copy link

changeset-bot bot commented Mar 19, 2026

⚠️ No Changeset found

Latest commit: ae4e2b5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot closed this Mar 19, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 19, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 00745b94-3a70-4974-8950-78fef575f76a

📥 Commits

Reviewing files that changed from the base of the PR and between 35298ac and ae4e2b5.

📒 Files selected for processing (1)
  • packages/cli-v3/src/config.ts

Walkthrough

The resolveConfig function in packages/cli-v3/src/config.ts has been modified to change how the runtime is determined. A new detectedRuntime value is introduced that checks for Bun's presence via typeof process.versions.bun === "string", defaulting to "node" otherwise. The defaultRuntime is now calculated by prioritizing user-provided config.runtime, then falling back to detectedRuntime, rather than deriving it solely from the run_engine_v2 compatibility feature. The resolved defaultRuntime continues to be written to the merged config.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can generate a title for your PR based on the changes.

Add @coderabbitai placeholder anywhere in the title of your PR and CodeRabbit will replace it with a title based on the changes in the PR. You can change the placeholder by changing the reviews.auto_title_placeholder setting.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment on lines +194 to +195
const detectedRuntime: BuildRuntime = typeof process.versions.bun === "string" ? "bun" : "node";
const defaultRuntime: BuildRuntime = config.runtime ?? detectedRuntime;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 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.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Deployment UI shows Node.js runtime when using Bun

1 participant