From 6cd6b21f83c62e7a1a022c606f2317b34c9270f4 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 19 Feb 2024 17:37:25 +0100 Subject: [PATCH] Fix build --- packages/server/src/jsRunner/vm/isolated-vm.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/server/src/jsRunner/vm/isolated-vm.ts b/packages/server/src/jsRunner/vm/isolated-vm.ts index 0285af8620..12559df0b7 100644 --- a/packages/server/src/jsRunner/vm/isolated-vm.ts +++ b/packages/server/src/jsRunner/vm/isolated-vm.ts @@ -7,6 +7,7 @@ import querystring from "querystring" import { BundleType, loadBundle } from "../bundles" import { VM } from "@budibase/types" +import environment from "../../environment" class ExecutionTimeoutError extends Error { constructor(message: string) { @@ -33,10 +34,13 @@ export class IsolatedVM implements VM { invocationTimeout, isolateAccumulatedTimeout, }: { - memoryLimit: number - invocationTimeout: number + memoryLimit?: number + invocationTimeout?: number isolateAccumulatedTimeout?: number - }) { + } = {}) { + memoryLimit = memoryLimit || environment.JS_RUNNER_MEMORY_LIMIT + invocationTimeout = memoryLimit || 1000 + this.isolate = new ivm.Isolate({ memoryLimit }) this.vm = this.isolate.createContextSync() this.jail = this.vm.global