mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(trigger): add isolated-vm support to trigger.dev container builds (#3269)
Scheduled workflow executions running in trigger.dev containers were failing to spawn isolated-vm workers because the native module wasn't available in the container. This caused loop condition evaluation to silently fail and exit after one iteration. - Add isolated-vm to build.external and additionalPackages in trigger config - Include isolated-vm-worker.cjs via additionalFiles for child process spawning - Add fallback path resolution for worker file in trigger.dev environment
This commit is contained in:
@@ -679,11 +679,15 @@ function spawnWorker(): Promise<WorkerInfo> {
|
||||
}
|
||||
|
||||
const currentDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
const workerPath = path.join(currentDir, 'isolated-vm-worker.cjs')
|
||||
const candidatePaths = [
|
||||
path.join(currentDir, 'isolated-vm-worker.cjs'),
|
||||
path.join(process.cwd(), 'lib', 'execution', 'isolated-vm-worker.cjs'),
|
||||
]
|
||||
const workerPath = candidatePaths.find((p) => fs.existsSync(p))
|
||||
|
||||
if (!fs.existsSync(workerPath)) {
|
||||
if (!workerPath) {
|
||||
settleSpawnInProgress()
|
||||
reject(new Error(`Worker file not found at ${workerPath}`))
|
||||
reject(new Error(`Worker file not found at any of: ${candidatePaths.join(', ')}`))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { additionalPackages } from '@trigger.dev/build/extensions/core'
|
||||
import { additionalFiles, additionalPackages } from '@trigger.dev/build/extensions/core'
|
||||
import { defineConfig } from '@trigger.dev/sdk'
|
||||
import { env } from './lib/core/config/env'
|
||||
|
||||
@@ -15,9 +15,11 @@ export default defineConfig({
|
||||
},
|
||||
dirs: ['./background'],
|
||||
build: {
|
||||
external: ['isolated-vm'],
|
||||
extensions: [
|
||||
additionalFiles({ files: ['./lib/execution/isolated-vm-worker.cjs'] }),
|
||||
additionalPackages({
|
||||
packages: ['unpdf', 'pdf-lib'],
|
||||
packages: ['unpdf', 'pdf-lib', 'isolated-vm'],
|
||||
}),
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user