Fix async/await issue in VM.ts

This commit is contained in:
Simon Larsen 2024-04-06 20:49:23 +01:00
parent f38d8ae452
commit 8282669fbd
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE
2 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ router.post(
},
});
result.returnValue = await result.returnValue;
} catch (err) {
logger.error(err);
throw new BadDataException((err as Error).message);

View File

@ -42,7 +42,7 @@ export default class VMUtil {
${code}
})()` || '';
const returnVal: any = vm.runInContext(script, sandbox, {
const returnVal: any = await vm.runInContext(script, sandbox, {
timeout: options.timeout || 5000,
}); // run the script