Closed jesterhazy closed 3 months ago
Seems to have broken with the latest SDK v3 versions
Can you identify a version this works on? The lines that the SDK throws on haven’t been modified recently (7-8 months or more).
On Tue, Jan 23, 2024 at 8:36 AM Paul Canning @.***> wrote:
Seems to have broken with the latest SDK v3 versions
— Reply to this email directly, view it on GitHub https://github.com/m-radzikowski/aws-sdk-client-mock/issues/206#issuecomment-1906460210, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD3LKSY4RHOQZCAJLQQ7BTYP7RH3AVCNFSM6AAAAABCCOM7VGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBWGQ3DAMRRGA . You are receiving this because you authored the thread.Message ID: @.***>
@jesterhazy the problem is you are providing the mockClient(S3Client)
output as an SDK Client to the Upload
. The mockClient()
returns AwsClientStub
, an object with methods to set up mock behavior. It's not the Client that you create with new S3Client()
.
In line 30 of your snippet you should create and pass a new S3 Client with new S3Client()
to the S3ClientWrapper
.
Also, please see the example in the README on mocking lib-storage
.
Checklist
Bug description
The Upload class (from
@aws-sdk/lib-storage
) throws a TypeError when used with a mocked S3 client.Trace:
Reproduction
Environment