diff --git a/packages/server/src/environment.ts b/packages/server/src/environment.ts index e300e86dc1..0e94b65df8 100644 --- a/packages/server/src/environment.ts +++ b/packages/server/src/environment.ts @@ -95,6 +95,8 @@ const environment = { TOP_LEVEL_PATH: process.env.TOP_LEVEL_PATH || process.env.SERVER_TOP_LEVEL_PATH, APP_MIGRATION_TIMEOUT: parseIntSafe(process.env.APP_MIGRATION_TIMEOUT), + JS_RUNNER_MEMORY_LIMIT: + parseIntSafe(process.env.JS_RUNNER_MEMORY_LIMIT) || 64, } // threading can cause memory issues with node-ts in development diff --git a/packages/server/src/jsRunner.ts b/packages/server/src/jsRunner.ts index 237b97b356..5b7bbf34ae 100644 --- a/packages/server/src/jsRunner.ts +++ b/packages/server/src/jsRunner.ts @@ -27,7 +27,9 @@ export function init() { const isolateRefs = bbCtx.isolateRefs if (!isolateRefs) { - const jsIsolate = new ivm.Isolate({ memoryLimit: 64 }) + const jsIsolate = new ivm.Isolate({ + memoryLimit: env.JS_RUNNER_MEMORY_LIMIT, + }) const jsContext = jsIsolate.createContextSync() const injectedRequire = `const require = function(val){