Catch errors properly in Node.js script for Puppeteer


I'm using Puppeteer to generate PDF documents (see [login to view URL]). This works well when there are no errors, but when there's a page error or when the URL is wrong (for example), then the script just hangs.

From what I understand this is because the promises after the promises that "crashes" are still trying to resolve, but I'm not a Node.js expert so I'm not sure.

I'm calling the node.js script form PHP, but the same thing happens when I call in the command line.

The script is similar (but more elaborate) to the default script that's on the Puppeteer website:

const puppeteer = require('puppeteer');

(async () => {

const browser = await [login to view URL]();

const page = await [login to view URL]();

await [login to view URL]('[login to view URL]', {waitUntil: 'networkidle2'});

await [login to view URL]({path: '[login to view URL]', format: 'A4'});

await [login to view URL]();


If the goto event fails for example then the script doesn't terminate.

What I need is someone to:

1) rewrite the script so it catches errors properly in a way that I can use them OUTSIDE the script as well (so when the PHP call is finished); I can read the output that the script generates so I'm guessing a combination of [login to view URL] and exit codes would work. You need to catch errors with the [login to view URL], but also [login to view URL] (error). More info on how other people seem to do this is on [login to view URL] and [login to view URL] and various other places on the web.

2) supply a way to call multiple instances of Puppeteer in a pool or other way so that I can just start a new page instead of a new browser every time I need a conversion. These instances don't need to live long, but I need to have at least one open all the time so the conversion can happen quickly. This is needed because I do many thousands of conversions a day and the time to wait for the browser to open is too long.

I need this done quickly so only reply if you're available to do this quickly and have the right experience with node.js


Compétences : node.js

en voir plus : Hi, I\ m the owner of a software company called Veen Software and I would like to have a logo designed for it. , Hi, I\ m looking for someone who can draw something similar to the image attached. In the image there\ s an astronaut drawn o, Hi! I\ m looking someone who can gather inf, hi i m web designer and web creator, hi i m virtual assistant, java script back end node js consultant outsourcer, freelance for node js in india, angular js node js, drupal node list script, add xml node existing script, drupal xml node import script, travian js script, simple js script, login js script, js script jquery ajax, js script http request referer, js script data mining, indesign merge js script, full js script webshop, ajax pop js script

Concernant l'employeur :
( 36 commentaires ) eindhoven, Netherlands

Nº du projet : #17286954

Décerné à:


Hi, I've done a few scripts in the past using Puppeteer. I will solve the problem related to error catching, and finally, provide a way to leave the browser instance opened so it will be responsive for the next conver Plus

%selectedBids___i_sum_sub_4% %project_currencyDetails_sign_sub_5% USD en 1 jour
(1 Évaluation)

6 freelance font une offre moyenne de $60 pour ce travail


Hi, how are you? I am a senior web developer with 5 years of experience in building websites. I am very experienced in web development with PHP(CodeIgniter, Laravel, WordPress, ...), Java(JSP, Spring, Hibernate, Stru Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 10 jours
(1 Évaluation)

Hi dear friend, I am expert in Node.js and can fix your script catche issue and all other errors which you have mentioned to fix.

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(1 Évaluation)
%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 5 jours
(0 Commentaires)

to handle errors in async/await you have to use try catch block. I am a back-end developer so i usually do this all the time in my code

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(0 Commentaires)

Hi, We have team of web developers with relevant experience of 4 to 15 years. They are highly experienced in building web applications using the following technologies- Bootstrap CSS, Angular Material, JavaScript f Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 10 jours
(0 Commentaires)