Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@aws-sdk/lib-storage: client is not compatible if lib-storage version and client version is different #1729

Closed
AllanZhengYP opened this issue Nov 30, 2020 · 2 comments · Fixed by #2039
Assignees
Labels
feature-request New feature or enhancement. May require GitHub community feedback.

Comments

@AllanZhengYP
Copy link
Contributor

Describe the bug
When supplying a non-modular client of different version to an uploader, us

SDK version number

Is the issue in the browser/Node.js/ReactNative?
Presumably all

To Reproduce (observed behavior)

import fs from "fs";
import { S3 } from "@aws-sdk/client-s3"; // from 1.0.0-gamma.2
import { Upload } from "@aws-sdk/lib-storage" // from 1.0.0-rc.7
(async () => {
  const client = new S3({
    region: "us-west-2",
    credentials: {
      accessKeyId: "",
      secretAccessKey: ""
    }
  });
  try {
    const upload = new Upload({
      client,
      params: {
        Bucket: "bucket",
        Key: "key",
        Body: fs.createReadStream("file.gzip")
      }
    });
    await upload.done();
  } catch(e) {
    console.log(e);
  }
})();

Error thrown when compiling:

sdkTest2.ts:16:7 - error TS2322: Type 'S3' is not assignable to type 'ServiceClients'.
  Type 'S3' is missing the following properties from type 'S3': deleteBucketIntelligentTieringConfiguration, deleteBucketOwnershipControls, getBucketIntelligentTieringConfiguration, getBucketOwnershipControls, and 3 more.

16       client,
         ~~~~~~

  node_modules/@aws-sdk/lib-storage/dist/cjs/upload/types.d.ts:42:9
    42         client: ServiceClients;
               ~~~~~~
    The expected type comes from property 'client' which is declared here on type 'Options'

Expected behavior
No error thrown

Additional context
The complained operations (deleteBucketIntelligentTieringConfiguration, deleteBucketOwnershipControls, getBucketIntelligentTieringConfiguration, getBucketOwnershipControls) are added after S3 version 1.0.0-gamma.2

@AllanZhengYP AllanZhengYP added the feature-request New feature or enhancement. May require GitHub community feedback. label Dec 8, 2020
@alexforsyth
Copy link
Contributor

Yeah this not a great user experience. Addressing in: #2039

@github-actions
Copy link

github-actions bot commented Mar 6, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request New feature or enhancement. May require GitHub community feedback.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants