Skip to content

Commit 7b51661

Browse files
koki-developclaude
andcommitted
fix: add --disable-wasm-trap-handler to Node.js runtimes to prevent OOM
V8's Wasm trap handler reserves a 10 GB virtual memory cage, which exceeds the sandbox rlimit_as (4096 MiB) and causes amaro/SWC to fail with "Cannot allocate Wasm memory" when Node.js strips TypeScript types. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8ee092e commit 7b51661

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

internal/sandbox/runtime.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ type nodeRuntime struct{}
176176
func (nodeRuntime) Name() RuntimeName { return RuntimeNode }
177177

178178
func (nodeRuntime) Command(entryFile string) []string {
179-
return []string{"/mise/installs/node/24.14.0/bin/node", entryFile}
179+
return []string{"/mise/installs/node/24.14.0/bin/node", "--disable-wasm-trap-handler", entryFile}
180180
}
181181

182182
func (nodeRuntime) BindMounts() []BindMount {
@@ -546,7 +546,7 @@ func (nodeTypeScriptRuntime) Name() RuntimeName { return RuntimeNodeTypeScript }
546546

547547
func (nodeTypeScriptRuntime) Command(entryFile string) []string {
548548
jsFile := strings.TrimSuffix(entryFile, path.Ext(entryFile)) + ".js"
549-
return []string{"/mise/installs/node/24.14.0/bin/node", jsFile}
549+
return []string{"/mise/installs/node/24.14.0/bin/node", "--disable-wasm-trap-handler", jsFile}
550550
}
551551

552552
func (nodeTypeScriptRuntime) BindMounts() []BindMount {
@@ -558,7 +558,7 @@ func (nodeTypeScriptRuntime) Env() []string {
558558
}
559559

560560
func (nodeTypeScriptRuntime) CompileCommand() []string {
561-
return []string{"/mise/installs/node/24.14.0/bin/node", "/sandbox/node_modules/typescript/bin/tsc"}
561+
return []string{"/mise/installs/node/24.14.0/bin/node", "--disable-wasm-trap-handler", "/sandbox/node_modules/typescript/bin/tsc"}
562562
}
563563

564564
func (nodeTypeScriptRuntime) CompileBindMounts() []BindMount {

0 commit comments

Comments
 (0)