I received the sts credential from the server and using it to create an s3 object and upload it.
// aws sdk v2
// STS credentials
//{aws_access_key_id, aws_secret_access_key, aws_session_token, basepath, bucket_name, bucket_region, acl, expires_at}
const s3 = new AWS.S3();
s3.config.update({
'region': region,
'accessKeyId': accessKeyId,
'secretAccessKey' : secretAccessKey,
'sessionToken': sessionToken,
'credentials': credentials,
'correctClockSkew': true
}
...
s3.upload()...
The provided token has expired ...
Because the file size was very large, an expiration error occurred if the upload could not be completed within the expiration time. The server side cannot increase the expiration time.
The only thing I can do in this situation is to obtain an STS again for the basepath of the same bucket.
Is there a way to insert the reissued STS in the middle of upload? I tried everything but failed. Or is there a way to force the credential provider to naturally refresh and retry between uploads?