Skip to content

Commit

Permalink
Handle AWS S3 Re-Authentication via s3.getSignedUrlPromise
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nmagedman committed Oct 16, 2023
1 parent 3826f7e commit 9b16aa4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/meteor/app/file-upload/ufs/AmazonS3/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

/**
Expand Down

0 comments on commit 9b16aa4

Please sign in to comment.