aws-sdk-js-v3: Bad types after smithy upgrade

Checkboxes for prior research

Describe the bug

Here are 2 examples of some issues I am experiencing with types with 3.363.0

I scanned through https://github.com/aws/aws-sdk-js-v3/blob/main/CHANGELOG.md and can’t find anything that makes these seem like intentional changes, sorry if this is all a bit vague but maybe someone with more information can ask more pointed questions/add something that helps.

3.362.0 is all good, 3.363.0 has all sorts of issues. The only change that seems relevant to me is https://github.com/aws/aws-sdk-js-v3/pull/4873

Issues I see with @aws-sdk/s3-request-presigner:

Argument of type 'S3' is not assignable to parameter of type 'Client<any, ServiceInputTypes, MetadataBearer, any>'.
  The types of 'middlewareStack.add' are incompatible between these types.
    Type '{ (middleware: InitializeMiddleware<ServiceInputTypes, ServiceOutputTypes>, options?: (InitializeHandlerOptions & AbsoluteLocation) | undefined): void; (middleware: SerializeMiddleware<...>, options: SerializeHandlerOptions & AbsoluteLocation): void; (middleware: BuildMiddleware<...>, options: BuildHandlerOptions & ...' is not assignable to type '{ (middleware: InitializeMiddleware<ServiceInputTypes, MetadataBearer>, options?: (InitializeHandlerOptions & AbsoluteLocation) | undefined): void; (middleware: SerializeMiddleware<...>, options: SerializeHandlerOptions & AbsoluteLocation): void; (middleware: BuildMiddleware<...>, options: BuildHandlerOptions & Abso...'.
      Types of parameters 'middleware' and 'middleware' are incompatible.
        Types of parameters 'next' and 'next' are incompatible.
          Type 'InitializeHandler<ServiceInputTypes, ServiceOutputTypes>' is not assignable to type 'InitializeHandler<ServiceInputTypes, MetadataBearer>'.
            Type 'ServiceOutputTypes' is not assignable to type 'MetadataBearer'.ts(2345)

image

Issues I see with @aws-sdk/client-s3:

Property 'Body' does not exist on type 'GetObjectCommandOutput'.ts(2339)

image

SDK version number

@aws-sdk/s3-request-presigner@3.363.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

node v18.16.0

Reproduction Steps

Code snippets in screenshots are one example

Observed Behavior

Lots of typescript errors and weirdness with 3.363.0

Expected Behavior

Types work correctly like in 3.362.0

Possible Solution

No response

Additional Information/Context

No response

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 24
  • Comments: 22 (3 by maintainers)

Most upvoted comments

Deleting my lock file and reinstalling seems to resolve the issues…

issue went away after forcing @smithy/types : 2.2.2 s3 was using 2.0.2 according to lock file

it happened to me in the newest version 3.465.0

it thinks it should be “new S3Client([{ region: ‘us-east1’ }])”, which throws region not found error instead of “new S3Client({ region: ‘us-east1’ })” which is correct but the typescript doesn’t accept

i tried to delete node_modules and the lock file like suggested, and also install the latest smithy/types 2.6.0 instead of relying on the dependency and it didn’t help

reverting to “@aws-sdk/client-s3”: “3.13.1” helped.