Skip to content

Bun worker production - #5163

Closed
ethandaniel wants to merge 2 commits into
triggerdotdev:mainfrom
ethandaniel:bun-worker-production
Closed

ethandaniel wants to merge 2 commits into
triggerdotdev:mainfrom
ethandaniel:bun-worker-production

Conversation

@ethandaniel

Copy link
Copy Markdown

Closes #

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

[Describe the steps you took to test this change]


Changelog

[Short description of what has changed]


Screenshots

[Screenshots]

💯

@changeset-bot

changeset-bot Bot commented Nov 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a8bb5aa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
trigger.dev Patch
@trigger.dev/build Patch
@trigger.dev/convex Patch
@trigger.dev/core Patch
@trigger.dev/linear Patch
@trigger.dev/python Patch
@trigger.dev/react-hooks Patch
@trigger.dev/redis-worker Patch
@trigger.dev/rsc Patch
@trigger.dev/schema-to-json Patch
@trigger.dev/slack Patch
@trigger.dev/sdk Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution! We require all external PRs to be opened in draft status first so you can address CodeRabbit review comments and ensure CI passes before requesting a review. Please re-open this PR as a draft. See CONTRIBUTING.md for details.

@github-actions github-actions Bot closed this Nov 27, 2026
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 2 potential issues.

Devin Review

return [
"env",
// Bun inlines process.env.NODE_ENV when compiling the deployed worker.
"NODE_ENV=production",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Compiled tasks ignore configured environment mode

bunCompileArgs overrides an explicit build-time NODE_ENV, so Bun compiles direct reads to production. Those reads stay unchanged even when the run worker installs a different runtime value.

Learn more

A custom build layer can set environment variables for the image build, and parseGenerateOptions exposes those values to build commands. Before this change, Bun read that environment when compiling. The new command replaces NODE_ENV even when it is explicitly set. The run worker still applies the project’s runtime variables, but they cannot change a string already compiled into the task.

Example: A staging deployment sets NODE_ENV=development in both its build layer and dashboard environment. A task that checks process.env.NODE_ENV === "development" no longer takes its staging branch after redeploying with bytecode enabled.

Recommended fix: Use production as the compiler default rather than replacing an explicit build value. Add a compiled-worker case with an explicit non-production value alongside the default-production case. If dashboard changes must take effect without a rebuild, verify a Bun setting or bundle transform that preserves runtime reads instead of folding them.

Devin Review


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

compiledRunWorker: NonNullable<GenerateContainerfileOptions["compiledRunWorker"]>
) {
return [
"env",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 New executable requirement for custom images

bunCompileArgs now requires env on PATH. The custom image requirements list BusyBox, which can provide the applet without exposing it as a standalone command.

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.

1 participant