diff --git a/packages/server/src/api/controllers/script.ts b/packages/server/src/api/controllers/script.ts index 7b07b97ba9..9a404da9fb 100644 --- a/packages/server/src/api/controllers/script.ts +++ b/packages/server/src/api/controllers/script.ts @@ -4,7 +4,8 @@ import { IsolatedVM } from "../../jsRunner/vm" export async function execute(ctx: Ctx) { const { script, context } = ctx.request.body const runner = new IsolatedVM(context) - const result = runner.execute(script) + + const result = runner.execute(`(function(){\n${script}\n})();`) ctx.body = result }