Skip to content

Commit 0e52877

Browse files
authored
Bugfix/Silent fallback to vm2 for sandbox execution (#6206)
silent fallback to vm2 for sandbox execution
1 parent 6ba035c commit 0e52877

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

packages/components/src/utils.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,18 +1608,14 @@ export const executeJavaScriptCode = async (
16081608
} = {}
16091609
): Promise<any> => {
16101610
const { timeout = 300000, useSandbox = true, streamOutput, libraries = [], nodeVMOptions = {} } = options
1611-
if (useSandbox && !process.env.E2B_APIKEY) {
1612-
throw new Error(
1613-
'Sandboxed code execution requires E2B_APIKEY to be configured. ' +
1614-
'Set E2B_APIKEY in your environment or contact your administrator.'
1615-
)
1616-
}
1611+
const shouldUseE2BSandbox = useSandbox && process.env.E2B_APIKEY
1612+
16171613
let timeoutMs = timeout
16181614
if (process.env.SANDBOX_TIMEOUT) {
16191615
timeoutMs = parseInt(process.env.SANDBOX_TIMEOUT, 10)
16201616
}
16211617

1622-
if (useSandbox) {
1618+
if (shouldUseE2BSandbox) {
16231619
try {
16241620
const variableDeclarations = []
16251621

0 commit comments

Comments
 (0)