I'm looking to iterate over a number of promises but the lambda function is completing before they are resolved.
module.exports.handler= async(event, context, callback) => {
let a = {'a': 'b', 'x', 'y'};
let b = {'i': 'n'};
Object.keys(listA).map(async ax => {
Object.keys(listB).map(async bx => {
await validate(ax, bx);
}
}
}
async function validate(a, b) {
let promise = getPromise(a, b);
await promise.then((output) => {
...
console.log('success');
});
}
How can all the promises be resolved before the process completes?