From 197dfd4e1176d22fef6de5871b2f187009667882 Mon Sep 17 00:00:00 2001 From: Matchu Date: Wed, 5 Aug 2020 14:03:14 -0700 Subject: [PATCH] Maybe fix PNG upload bug in prod? My hypothesis is that this missing `await` is causing prod Vercel to cut off the request before the async upload finishes. Omitting this `await` was a mistake, so I'm just adding it right in! I also add logging for the success case. That way, if this isn't actually a fix, I can at least watch the logs and confirm whether the app thinks it's getting to here. --- api/uploadLayerImage.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/uploadLayerImage.js b/api/uploadLayerImage.js index 72b9a4f..040e962 100644 --- a/api/uploadLayerImage.js +++ b/api/uploadLayerImage.js @@ -38,7 +38,8 @@ async function processImage(assetType, remoteId, size, imageData) { const id3 = paddedId.slice(6, 9); const key = `${assetType}/${id1}/${id2}/${id3}/${remoteId}/${size}x${size}.png`; - upload("impress-asset-images", key, imageData); + await upload("impress-asset-images", key, imageData); + console.log(`Successfully uploaded ${key} to impress-asset-images`); } export default async (req, res) => {