Race condition in s3-request-presigner because client is mutated #3672
Labels
bug
This issue is a bug.
needs-review
This issue/pr needs review from an internal developer.
p2
This is a standard priority issue
Describe the bug
s3-request-presigner
package provides a function getSignedUrl that acceptsclient
,command
andoptions
.Based on the source code, it works like this:
client
This happens asynchronously, so there is a time interval when this middleware is attached to
client
. If theclient
is used during this time interval elsewhere, that other request can break because of this middleware. This can even cause problems if we callgetSignedUrl
two times in parallel with the sameclient
, say withPromise.all
.Expected Behavior
client
should not be mutated insidegetSignedUrl
In concrete example, if we follow the reproduction steps below, we should get the following array logged:
Current Behavior
client
is mutated and it breaks other requests running at the same time.In concrete example, if we follow the reproduction steps below, we'll get the following array logged:
First element of the array is ok and as expected. The second element contains the raw response from the middleware attached by
getSignedUrl
.Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
SDK version used
3.105.0
Environment details (OS name and version, etc.)
Windows 10 21H2, nodejs v16.14.2
The text was updated successfully, but these errors were encountered: