Repository navigation
Bun worker production - #5163
ethandaniel wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: a8bb5aa The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
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 |
|
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. |
|
Caution Review failedThe pull request is closed.
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. |
| return [ | ||
| "env", | ||
| // Bun inlines process.env.NODE_ENV when compiling the deployed worker. | ||
| "NODE_ENV=production", |
There was a problem hiding this comment.
🟡 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
| compiledRunWorker: NonNullable<GenerateContainerfileOptions["compiledRunWorker"]> | ||
| ) { | ||
| return [ | ||
| "env", |
There was a problem hiding this comment.
🔍 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
Closes #
✅ Checklist
Testing
[Describe the steps you took to test this change]
Changelog
[Short description of what has changed]
Screenshots
[Screenshots]
💯