diff --git a/src/routes/queue-route.ts b/src/routes/queue-route.ts index 301e3be..36e9fdd 100644 --- a/src/routes/queue-route.ts +++ b/src/routes/queue-route.ts @@ -26,13 +26,11 @@ router.post("/pdf", async (req: Request, res: Response) => { } if(job) { - let state = await job.getState() let response: response = job.returnvalue; res.download(response.path); + } else { + throw new Error("Some Error Occurred While Queueing") } - - throw new Error("Some Error Occurred While Queueing") - } catch (err ) { res.json({ success: false, diff --git a/src/utils/sandbox_worker.ts b/src/utils/sandbox_worker.ts index 5b95c4b..92cc543 100644 --- a/src/utils/sandbox_worker.ts +++ b/src/utils/sandbox_worker.ts @@ -21,9 +21,16 @@ module.exports = async (job: SandboxedJob) => { ); if(payload.otherPageFunctions) { - for(let fn of Object.keys(payload.otherPageFunctions)) { - // @ts-ignore - await page[fn](...payload.otherPageFunctions[fn]) + for(let fn of payload.otherPageFunctions) { + + if(fn.length>0) { + // @ts-ignore + await page[fn[0]](...fn[1]) + } else { + // @ts-ignore + await page[fn[0]]() + } + } }