-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Description
When using runtime: 'bun' in trigger.config.ts, deploying a project that has "workspaces" in package.json fails with:
error: Workspace not found "frontend"
at /app/package.json:50:5
The same project deploys successfully with runtime: 'node-22'.
Root Cause
The generated Containerfile copies only package.json before running bun install:
COPY --chown=bun:bun package.json ./ # Only root package.json
RUN bun install --production --no-save # Bun validates workspaces strictly → ERROR
COPY --chown=bun:bun . ./ # Workspace dirs arrive here, too latenpm/node tolerates missing workspace directories during install (warns but continues).
Bun strictly validates that all referenced workspaces exist and exits with an error if they don't.
Reproduction
- Have a
package.jsonwith workspaces:
{
"workspaces": ["frontend"]
}- Set
runtime: 'bun'intrigger.config.ts:
export default defineConfig({
project: 'my-project',
runtime: 'bun',
});-
Run
trigger deploy→ build fails at thebun installstep. -
Change to
runtime: 'node-22'→ build succeeds.
Environment
- CLI version: 4.4.1
- Cloud version: 4.4.3
- Bun version in image: 1.3.3 (
imbios/bun-node:1.3.3-20-slim) - OS: Ubuntu (GitHub Actions CI)
Suggested Fix
When runtime: 'bun', the Containerfile should handle workspaces before bun install. Some options:
-
Copy workspace
package.jsonfiles alongside the rootpackage.jsonbefore install:COPY --chown=bun:bun package.json ./ COPY --chown=bun:bun frontend/package.json ./frontend/ RUN bun install --production --no-save
-
Strip the
workspacesfield from package.json before runningbun install:COPY --chown=bun:bun package.json ./ RUN node -e "const p=JSON.parse(require('fs').readFileSync('package.json','utf8'));delete p.workspaces;require('fs').writeFileSync('package.json',JSON.stringify(p,null,2))" RUN bun install --production --no-save
-
Allow build extensions to inject Containerfile instructions between
COPY package.jsonandRUN bun install(currentlyaddLayeronly appends after the main build steps).
Workaround
Use runtime: 'node-22' instead of 'bun'. With processKeepAlive: true, warm starts are 100-300ms regardless of runtime, so the cold start difference is negligible for most workloads.