Nice write-up! I was about to write something similar but you went into far more detail than I was planning on.

The particular case I want to share with everybody is to *not* do:

someArray.forEach(async () => { await stuff(); });

It's a trap! There is no way to wait for the resulting promises. Instead, use:

await Promise.all(someArray.map(async () => { await stuff(); }));

Consulting Software Engineer and AWS Solutions Architect with over 34 years of experience. Specializing in AWS serverless application development and IoT.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store