From 9b16aa4ce118c24be290bd658ccc84cd5ee995c3 Mon Sep 17 00:00:00 2001 From: Noach Magedman Date: Wed, 13 Sep 2023 15:31:19 +0300 Subject: [PATCH] Handle AWS S3 Re-Authentication via s3.getSignedUrlPromise AWS credentials have a limited lifespan. If the credentials have expired when you call `s3.getSignedUrl`, the call will fail, although it will eventually succeed after the credentials are refreshed in the background. Calling `s3.getSignedUrlPromise` causes it to wait for the credentials to refresh and then successfully return a signed url. --- apps/meteor/app/file-upload/ufs/AmazonS3/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/app/file-upload/ufs/AmazonS3/server.ts b/apps/meteor/app/file-upload/ufs/AmazonS3/server.ts index 5ec84c563432..ccf2245d99ac 100644 --- a/apps/meteor/app/file-upload/ufs/AmazonS3/server.ts +++ b/apps/meteor/app/file-upload/ufs/AmazonS3/server.ts @@ -80,7 +80,7 @@ class AmazonS3Store extends UploadFS.Store { ResponseContentDisposition: `${forceDownload ? 'attachment' : 'inline'}; filename="${encodeURI(file.name || '')}"`, }; - return s3.getSignedUrl('getObject', params); + return s3.getSignedUrlPromise('getObject', params); }; /**