How to handle promise.all with express node.js ECONNRESET

Viewed 130

I am webscraping a website using axios and cheerio and when I am trying to fetch a 20 ( more or less) links from the web, an ECONNRESET error is triggered. I am using the promise.all to handle it, but the mistake always appear. Is there any error on my code? How could I solve this?

let listEntrants    = await Promise.all(listCalls.map(async call =>{
                            let entrant    =   await getEntrantId(call.url);
                            return {attendee : call.attendee, entrant : entrant};
                    }));

The listCalls are the urls and the method getEntrantId() it return me the info I want.

Thanks.

0 Answers
Related