const images = await tbl
.find({
creator_id: req.user._id,
})
.select({
creator_id: 0,
})
.then((images) =>
images.forEach((image) => {
image.file_name = process.env.IMAGE_HOST_URL + image.file_name;
})
);
It fails in the .then bit. Not sure why.
The issue happens because your promise is already resolved before you call .then. remove the await or break out the .then to stay on its own
const images = tbl
.find({
creator_id: req.user._id,
})
.select({
creator_id: 0,
})
.then((images) =>
images.forEach((image) => {
image.file_name = process.env.IMAGE_HOST_URL + image.file_name;
})
);