puppeteer-pdf icon indicating copy to clipboard operation
puppeteer-pdf copied to clipboard

Cloud Deployment - Unhandled promise rejection

Open blackode opened this issue 5 years ago • 4 comments

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 :)

blackode avatar Dec 15 '19 22:12 blackode

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 avatar Dec 16 '19 02:12 speeddragon

@speeddragon Sure, I will update timeout will let you know.

blackode avatar Dec 16 '19 05:12 blackode

@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

blackode avatar Dec 16 '19 06:12 blackode

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.

speeddragon avatar Dec 16 '19 13:12 speeddragon