The createBucket method is mutating the object passed as parameter #3013
Labels
closing-soon
This issue will automatically close in 4 days unless further comments are made.
guidance
Question that needs advice or information.
Confirm by changing [ ] to [x] below to ensure that it's a bug:
Describe the bug
The
createBucket
method in AWS.S3 is mutating the object passed as parameter.Is the issue in the browser/Node.js?
Node.js
If on Node.js, are you running this on AWS Lambda?
No
Details of the browser/Node.js version
v12.13.0
SDK version number
v2.585.0
To Reproduce (observed behavior)
After running the above core, the value of
params
is now:Which causes problems if someone is reusing the same object in a different call, for example:
Expected behavior
After calling
createBucket
, the original object used as parameter shouldn't be mutated.Workaround
Freezing the object before passing it as parameter seems to stop this behavior.
As modules don't run in strict mode by default, the attempt to change the original object won't throw an exception and will just be ignored.
The text was updated successfully, but these errors were encountered: