I am running a migration script in sequelize:
let sort = 10;
return await queryInterface.sequelize.transaction(async (transaction) => {
await Promise.all(
sortedHolidays.map((holidayName) => {
sort += 10;
await Model.Holiday.update({ sort }, { where: { holidayName }, transaction });
})
);
});
I defined all my functions async, and awaiting all the functions, why am i getting this error of :
Await is only valid in async functions and the top level bodies of modules?