Skip to content

Commit 397ea37

Browse files
authored
chore(trigger): run tasks on the bun-1.4 runtime (#9481)
1 parent 9fffbcc commit 397ea37

7 files changed

Lines changed: 57 additions & 26 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ jobs:
287287
if [ -n "$TRIGGER_BRANCH" ]; then
288288
TARGET_ARGS+=(--branch "$TRIGGER_BRANCH")
289289
fi
290-
bunx trigger.dev@4.7.6 deploy "${TARGET_ARGS[@]}" --skip-promotion
290+
bunx trigger.dev@4.8.2 deploy "${TARGET_ARGS[@]}" --skip-promotion
291291
292292
- name: Validate deployment version output
293293
env:
@@ -638,7 +638,7 @@ jobs:
638638
if [ -n "$TRIGGER_BRANCH" ]; then
639639
TARGET_ARGS+=(--branch "$TRIGGER_BRANCH")
640640
fi
641-
bunx trigger.dev@4.7.6 promote "$VERSION" "${TARGET_ARGS[@]}"
641+
bunx trigger.dev@4.8.2 promote "$VERSION" "${TARGET_ARGS[@]}"
642642
643643
# Production only, once the new app serves traffic: submit the library and comparison URLs this
644644
# push changed to IndexNow. Best effort: nothing depends on it, and a failure never fails the run.

‎.github/workflows/trigger-dev.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
set -euo pipefail
4242
: "${TRIGGER_ACCESS_TOKEN:?TRIGGER_ACCESS_TOKEN_PREVIEW or TRIGGER_ACCESS_TOKEN must be configured}"
4343
: "${TRIGGER_PROJECT_ID:?TRIGGER_PROJECT_ID must be configured}"
44-
bunx trigger.dev@4.7.6 deploy --env preview --branch dev-sim --skip-promotion
44+
bunx trigger.dev@4.8.2 deploy --env preview --branch dev-sim --skip-promotion
4545
4646
- name: Promote current dev preview
4747
working-directory: ./apps/sim
@@ -61,4 +61,4 @@ jobs:
6161
echo "::notice::Skipping superseded dev task version $VERSION"
6262
exit 0
6363
fi
64-
bunx trigger.dev@4.7.6 promote "$VERSION" --env preview --branch dev-sim
64+
bunx trigger.dev@4.8.2 promote "$VERSION" --env preview --branch dev-sim

‎apps/sim/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@
174174
"@tiptap/starter-kit": "3.31.4",
175175
"@tiptap/suggestion": "3.31.4",
176176
"@tiptap/y-tiptap": "3.0.7",
177-
"@trigger.dev/core": "4.7.6",
178-
"@trigger.dev/sdk": "4.7.6",
177+
"@trigger.dev/core": "4.8.2",
178+
"@trigger.dev/sdk": "4.8.2",
179179
"@typescript/typescript6": "^6.0.2",
180180
"@xterm/addon-fit": "0.11.0",
181181
"@xterm/addon-unicode11": "0.9.0",
@@ -295,7 +295,7 @@
295295
"@tailwindcss/postcss": "^4.3.3",
296296
"@tailwindcss/typography": "0.5.20",
297297
"@testing-library/jest-dom": "^6.10.0",
298-
"@trigger.dev/build": "4.7.6",
298+
"@trigger.dev/build": "4.8.2",
299299
"@types/archiver": "8.0.0",
300300
"@types/busboy": "1.5.4",
301301
"@types/chrome": "0.3.6",

‎apps/sim/trigger.config.ts‎

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'
44
import { resourceFromAttributes } from '@opentelemetry/resources'
55
import { createLogger } from '@sim/logger'
66
import { distrustCompromisedRoots } from '@sim/security/tls-trust'
7+
import type { BuildExtension } from '@trigger.dev/build'
78
import {
89
additionalFiles,
910
additionalPackages,
@@ -65,6 +66,42 @@ function getFunctionExecutionEnvVars() {
6566
})
6667
}
6768

69+
/**
70+
* Node.js version copied into the task image, in lockstep with `NODE_VERSION`
71+
* in `docker/app.Dockerfile`: `isolated-vm` 6.x loads its Node 24 (ABI 137)
72+
* prebuild. The image is pinned by its multi-arch index digest.
73+
*/
74+
const NODE_VERSION = '24.22.1'
75+
const NODE_IMAGE = `node:${NODE_VERSION}-bookworm-slim@sha256:be8204d4bd327363357f532187b752ff62759c31bedf98e9e18fc08c9cbd605c`
76+
77+
/**
78+
* Tasks run on Bun, but the `bun-1.4` image ships no `node`, and the
79+
* isolated-vm sandbox worker and the Oracle Database worker are spawned as
80+
* `node` child processes, the same split as the app image. Adding image
81+
* instructions also builds the install stage from this base, so `bun install`
82+
* runs `isolated-vm`'s install script against the same Node. Deploy only:
83+
* `trigger dev` spawns the developer's own `node`.
84+
*
85+
* @see https://trigger.dev/docs/guides/frameworks/bun#choosing-a-bun-runtime
86+
*/
87+
function nodeBinary(): BuildExtension {
88+
return {
89+
name: 'node-binary',
90+
onBuildComplete(context) {
91+
if (context.target === 'dev') return
92+
context.addLayer({
93+
id: 'node-binary',
94+
image: {
95+
instructions: [
96+
`COPY --from=${NODE_IMAGE} /usr/local/bin/node /usr/local/bin/node`,
97+
`RUN [ "$(node --version)" = "v${NODE_VERSION}" ]`,
98+
],
99+
},
100+
})
101+
},
102+
}
103+
}
104+
68105
const grafanaTelemetry = grafanaFullyConfigured
69106
? (() => {
70107
const baseUrl = grafanaEndpoint!.replace(/\/+$/, '')
@@ -88,7 +125,7 @@ const grafanaTelemetry = grafanaFullyConfigured
88125

89126
export default defineConfig({
90127
project: env.TRIGGER_PROJECT_ID!,
91-
runtime: 'node-24',
128+
runtime: 'bun-1.4',
92129
logLevel: 'info',
93130
maxDuration: 5400,
94131
retries: {
@@ -159,6 +196,7 @@ export default defineConfig({
159196
'sharp',
160197
],
161198
extensions: [
199+
nodeBinary(),
162200
syncEnvVars(() => [
163201
{ name: 'DB_APP_NAME', value: 'sim-trigger' },
164202
/**

‎bun.lock‎

Lines changed: 6 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docker/app.Dockerfile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ FROM oven/bun:1.4.4-slim AS base
77
# Node runs the isolated-vm sandbox worker and the Oracle Database worker (the
88
# app itself runs under Bun); the version is kept in lockstep with the
99
# `isolated-vm` pin in apps/sim/package.json — Node 24 (ABI 137) requires
10-
# isolated-vm 6.x.
10+
# isolated-vm 6.x — and with NODE_VERSION in apps/sim/trigger.config.ts, which
11+
# copies the same Node into the Bun-based Trigger.dev task image.
1112
#
1213
# NODE_VERSION pins the exact NodeSource build: this layer is cached, so an
1314
# unpinned `nodejs` changed only when an unrelated edit forced a rebuild. The

‎packages/security/src/tls-trust.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import tls from 'node:tls'
88
* already excludes all four, so dropping them leaves the process trusting what
99
* Firefox trusts. Upstream runtimes ship their own blocklists (Node.js #66871,
1010
* Bun #46159); once a deployed runtime has one, these roots are absent from its
11-
* store and {@link distrustCompromisedRoots} changes nothing. The Bun services
12-
* run a Bun that has it, so only the Trigger.dev task runtime, whose Node build
13-
* the platform chooses, still calls this.
11+
* store and {@link distrustCompromisedRoots} changes nothing. Every service now
12+
* runs a Bun that has it; the Trigger.dev task runtime still calls this at
13+
* start because the platform chooses that image's Bun build.
1414
*/
1515
const COMPROMISED_ROOT_SPKI_SHA256 = new Set([
1616
'8d417db2dd8bf5e3084d1e3f196d583849d81bdd4c00c70b9d39369e96b8c782', // emSign ECC Root CA - G3

0 commit comments

Comments
 (0)