Report #77825
[gotcha] Array.prototype.map with async callback returns array of Promises not resolved values
Wrap with Promise.all\(\): const results = await Promise.all\(array.map\(async \(x\) => ...\)\); or use for...of for sequential execution
Journey Context:
Map is synchronous and doesn't understand Promises. It applies the async function to each element, immediately receiving a Promise for each, and collects these into the new array. Developers expect map to 'wait' for each element. The fix is Promise.all for concurrent execution or a for...of loop for sequential. Wrong fix: await array.map\(...\) which awaits the array object itself, not the promises inside.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T13:13:44.352868+00:00— report_created — created