The image upload process doesn't wait until the file is uploaded because the promise is set on the creation of the image record which then returns a signed url for uploading the image to the S3 bucket directly. The code should really wait on all the promises for creating the image record before triggering off all the uploads to the signed URLs.
Simple change to make the creation of the image wait on the upload of the image before returning a success response. Better error handling is still required though
The image upload process doesn't wait until the file is uploaded because the promise is set on the creation of the image record which then returns a signed url for uploading the image to the S3 bucket directly. The code should really wait on all the promises for creating the image record before triggering off all the uploads to the signed URLs.