puppeteer-pdf
puppeteer-pdf copied to clipboard
Cloud Deployment - Unhandled promise rejection
When I deployed in cloud, I am encountering Unhandled Promise Rejection
I deployed my app in CleverCloud
The app get crashed whenever I ran PuppeteerPdf.Generate.from_file(html_file, output_pdf_file)
.
I suspect above statement is throwing an Exception.
Note: When I ran Locally by clonning, it is working fine.
Please Refer to the following log
-- ASYNC --
2019-12-16T02:55:14+05:30 at Page.
(/home/bas/app_ff1741ae-722a-475a-a7b6-ee4c9a444298/priv/assets/node_modules/puppeteer/lib/helper.js:111:15)
2019-12-16T02:55:14+05:30 at /home/bas/app_ff1741ae-722a-475a-a7b6-ee4c9a444298/priv/assets/node_modules/puppeteer-pdf/puppeteer-pdf.js:118:14 2019-12-16T02:55:14+05:30 at process._tickCallback (internal/process/next_tick.js:68:7)
2019-12-16T02:55:14+05:30 (node:2359) UnhandledPromiseRejectionWarning: > Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
2019-12-16T02:55:14+05:30 (node:2359) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Let me know if you need more information on this.
Thanks :)
Not sure what could be the error, but looking into this issue try to increase the timeout (I think the default is 5000ms). Because it might be running in a slower machine, it might take longer to generate the pdf file.
@speeddragon Sure, I will update timeout
will let you know.
@speeddragon I updated timeout to 100000
and I tried to catch the error
[error] Task #PID<0.1735.0> started from #PID<0.1734.0> terminating 2019-12-16T12:07:37+05:30 ** (stop) exited in: Task.await(%Task{owner: #PID<0.1735.0>, pid: #PID<0.1737.0>, ref: #Reference<0.752368420.3634888705.38268>}, 100000) 2019-12-16T12:07:37+05:30 ** (EXIT) time out
So, with the error above we can confirm that the task is giving timeout. Not sure we can do anything. I've used similar services before, but it was deployed under a Docker container.