aws-sdk-js-v3 icon indicating copy to clipboard operation
aws-sdk-js-v3 copied to clipboard

Can't create new S3 client

Open Schotsl opened this issue 3 years ago • 5 comments
trafficstars

Describe the bug

I'm trying to create an instance of the S3Client with a DigitalOcean endpoint, when I run the code with -A and --unstable I get 8 errors (I get 21 without the -A and --unstable).

Your environment

I'm running Deno on MacOS Monterey v12.1

SDK version number

@aws_sdk/[email protected]

Details of the deno version

deno 1.18.0 (release, x86_64-apple-darwin) v8 9.8.177.6 typescript 4.5.2

Steps to reproduce

import { S3Client } from "https://deno.land/x/[email protected]/client-s3/S3Client.ts";

const region = "ams3";
const endpoint = "https://ams3.digitaloceanspaces.com";
const credentials = {
  accessKeyId: "ACCESS_KEY_ID",
  secretAccessKey: "SECRET_ACCESS_KEY",
};

new S3Client({ region, endpoint, credentials });

If someone needs the API keys for testing you can contact me privately and I'll be glad to provide them, there is nothing on my bucket so it's safe for testing.

Observed behavior

When I execute the coding using deno run -A --unstable index.ts I get this error back:

error: TS2345 [ERROR]: Argument of type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; defaultUserAgentProvider: Provider<UserAgent>; ... 17 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 4 more ... & UserAgentResolvedConfig' is not assignable to parameter of type 'SSOClientResolvedConfig'.
  Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; defaultUserAgentProvider: Provider<UserAgent>; ... 17 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 4 more ... & UserAgentResolvedConfig' is not assignable to type 'Required<ClientDefaults>'.
    Types of property 'sha256' are incompatible.
      Type 'HashConstructor | ((secret?: any) => void)' is not assignable to type 'HashConstructor'.
        Type '(secret?: any) => void' is not assignable to type 'HashConstructor'.
          Type '(secret?: any) => void' provides no match for the signature 'new (secret?: SourceData | undefined): Hash'.
    super(_config_5);
          ~~~~~~~~~
    at https://deno.land/x/[email protected]/client-sso/SSOClient.ts:228:11

TS2322 [ERROR]: Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; defaultUserAgentProvider: Provider<UserAgent>; ... 17 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 4 more ... & UserAgentResolvedConfig' is not assignable to type 'SSOClientResolvedConfig'.
    this.config = _config_5;
    ~~~~~~~~~~~
    at https://deno.land/x/[email protected]/client-sso/SSOClient.ts:229:5

TS2345 [ERROR]: Argument of type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 23 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & RegionResolvedConfig & EndpointsResolvedConfig & RetryResolvedConf...' is not assignable to parameter of type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 23 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 5 more ... & StsAuthInputConfig'.
  Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 23 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & RegionResolvedConfig & EndpointsResolvedConfig & RetryResolvedConf...' is not assignable to type 'PreviouslyResolved'.
    Types of property 'sha256' are incompatible.
      Type 'HashConstructor | ((secret?: any) => void)' is not assignable to type 'HashConstructor'.
        Type '(secret?: any) => void' is not assignable to type 'HashConstructor'.
    let _config_5 = resolveStsAuthConfig(_config_4, { stsClientCtor: STSClient });
                                         ~~~~~~~~~
    at https://deno.land/x/[email protected]/client-sts/STSClient.ts:244:42

TS2345 [ERROR]: Argument of type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 23 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 5 more ... & UserAgentResolvedConfig' is not assignable to parameter of type 'STSClientResolvedConfig'.
  Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 23 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 5 more ... & UserAgentResolvedConfig' is not assignable to type 'Required<ClientDefaults>'.
    Types of property 'sha256' are incompatible.
      Type 'HashConstructor | ((secret?: any) => void)' is not assignable to type 'HashConstructor'.
        Type '(secret?: any) => void' is not assignable to type 'HashConstructor'.
    super(_config_6);
          ~~~~~~~~~
    at https://deno.land/x/[email protected]/client-sts/STSClient.ts:246:11

TS2322 [ERROR]: Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 23 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 5 more ... & UserAgentResolvedConfig' is not assignable to type 'STSClientResolvedConfig'.
    this.config = _config_6;
    ~~~~~~~~~~~
    at https://deno.land/x/[email protected]/client-sts/STSClient.ts:247:5

TS2345 [ERROR]: Argument of type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 31 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & RegionResolvedConfig & EndpointsResolvedConfig & RetryResolvedConf...' is not assignable to parameter of type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 31 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 5 more ... & PreviouslyResolved'.
  Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 31 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & RegionResolvedConfig & EndpointsResolvedConfig & RetryResolvedConf...' is not assignable to type 'PreviouslyResolved'.
    Types of property 'sha256' are incompatible.
      Type 'HashConstructor | ((secret?: any) => void)' is not assignable to type 'HashConstructor'.
        Type '(secret?: any) => void' is not assignable to type 'HashConstructor'.
    let _config_5 = resolveAwsAuthConfig(_config_4);
                                         ~~~~~~~~~
    at https://deno.land/x/[email protected]/client-s3/S3Client.ts:691:42

TS2345 [ERROR]: Argument of type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 31 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 7 more ... & EventStreamSerdeResolvedConfig' is not assignable to parameter of type 'S3ClientResolvedConfig'.
  Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 31 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 7 more ... & EventStreamSerdeResolvedConfig' is not assignable to type 'Required<ClientDefaults>'.
    Types of property 'sha256' are incompatible.
      Type 'HashConstructor | ((secret?: any) => void)' is not assignable to type 'HashConstructor'.
        Type '(secret?: any) => void' is not assignable to type 'HashConstructor'.
    super(_config_8);
          ~~~~~~~~~
    at https://deno.land/x/[email protected]/client-s3/S3Client.ts:695:11

TS2322 [ERROR]: Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 31 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 7 more ... & EventStreamSerdeResolvedConfig' is not assignable to type 'S3ClientResolvedConfig'.
    this.config = _config_8;
    ~~~~~~~~~~~
    at https://deno.land/x/[email protected]/client-s3/S3Client.ts:696:5

Found 8 errors.

Expected behavior

Since my code only creates a s3Client, I expected the code to exit after creating the client with no output.

Schotsl avatar Jan 25 '22 12:01 Schotsl

I'm experiencing the same Typescript error.

jamesej avatar Feb 06 '22 18:02 jamesej

You might be able to use --no-check as a testing workaround.

This disabled type checking all together! Use with caution.

wouterdebruijn avatar Feb 09 '22 22:02 wouterdebruijn

I'm also having this exact bug.

Scionax avatar Feb 14 '22 23:02 Scionax

I am experiencing similar issues with the SQS Client:

error: TS2345 [ERROR]: Argument of type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; defaultUserAgentProvider: Provider<UserAgent>; ... 17 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 4 more ... & UserAgentResolvedConfig' is not assignable to parameter of type 'SSOClientResolvedConfig'.
  Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; defaultUserAgentProvider: Provider<UserAgent>; ... 17 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 4 more ... & UserAgentResolvedConfig' is not assignable to type 'Required<ClientDefaults>'.
    Types of property 'sha256' are incompatible.
      Type 'HashConstructor | ((secret?: any) => void)' is not assignable to type 'HashConstructor'.
        Type '(secret?: any) => void' is not assignable to type 'HashConstructor'.
          Type '(secret?: any) => void' provides no match for the signature 'new (secret?: SourceData | undefined): Hash'.
    super(_config_5);
          ~~~~~~~~~
    at https://deno.land/x/[email protected]/client-sso/SSOClient.ts:228:11

TS2322 [ERROR]: Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; defaultUserAgentProvider: Provider<UserAgent>; ... 17 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 4 more ... & UserAgentResolvedConfig' is not assignable to type 'SSOClientResolvedConfig'.
    this.config = _config_5;
    ~~~~~~~~~~~
    at https://deno.land/x/[email protected]/client-sso/SSOClient.ts:229:5

TS2345 [ERROR]: Argument of type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 23 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & RegionResolvedConfig & EndpointsResolvedConfig & RetryResolvedConf...' is not assignable to parameter of type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 23 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 5 more ... & StsAuthInputConfig'.
  Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 23 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & RegionResolvedConfig & EndpointsResolvedConfig & RetryResolvedConf...' is not assignable to type 'PreviouslyResolved'.
    Types of property 'sha256' are incompatible.
      Type 'HashConstructor | ((secret?: any) => void)' is not assignable to type 'HashConstructor'.
        Type '(secret?: any) => void' is not assignable to type 'HashConstructor'.
    let _config_5 = resolveStsAuthConfig(_config_4, { stsClientCtor: STSClient });
                                         ~~~~~~~~~
    at https://deno.land/x/[email protected]/client-sts/STSClient.ts:244:42

TS2345 [ERROR]: Argument of type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 23 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 5 more ... & UserAgentResolvedConfig' is not assignable to parameter of type 'STSClientResolvedConfig'.
  Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 23 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 5 more ... & UserAgentResolvedConfig' is not assignable to type 'Required<ClientDefaults>'.
    Types of property 'sha256' are incompatible.
      Type 'HashConstructor | ((secret?: any) => void)' is not assignable to type 'HashConstructor'.
        Type '(secret?: any) => void' is not assignable to type 'HashConstructor'.
    super(_config_6);
          ~~~~~~~~~
    at https://deno.land/x/[email protected]/client-sts/STSClient.ts:246:11

TS2322 [ERROR]: Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 23 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 5 more ... & UserAgentResolvedConfig' is not assignable to type 'STSClientResolvedConfig'.
    this.config = _config_6;
    ~~~~~~~~~~~
    at https://deno.land/x/[email protected]/client-sts/STSClient.ts:247:5

TS2345 [ERROR]: Argument of type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 24 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & RegionResolvedConfig & EndpointsResolvedConfig & RetryResolvedConf...' is not assignable to parameter of type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 24 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 5 more ... & PreviouslyResolved'.
  Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 24 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & RegionResolvedConfig & EndpointsResolvedConfig & RetryResolvedConf...' is not assignable to type 'PreviouslyResolved'.
    Types of property 'sha256' are incompatible.
      Type 'HashConstructor | ((secret?: any) => void)' is not assignable to type 'HashConstructor'.
        Type '(secret?: any) => void' is not assignable to type 'HashConstructor'.
    let _config_5 = resolveAwsAuthConfig(_config_4);
                                         ~~~~~~~~~
    at https://deno.land/x/[email protected]/client-sqs/SQSClient.ts:359:42

TS2345 [ERROR]: Argument of type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 24 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 5 more ... & UserAgentResolvedConfig' is not assignable to parameter of type 'SQSClientResolvedConfig'.
  Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 24 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 5 more ... & UserAgentResolvedConfig' is not assignable to type 'Required<ClientDefaults>'.
    Types of property 'sha256' are incompatible.
      Type 'HashConstructor | ((secret?: any) => void)' is not assignable to type 'HashConstructor'.
        Type '(secret?: any) => void' is not assignable to type 'HashConstructor'.
    super(_config_6);
          ~~~~~~~~~
    at https://deno.land/x/[email protected]/client-sqs/SQSClient.ts:361:11

TS2322 [ERROR]: Type '{ runtime: string; base64Decoder: Decoder; base64Encoder: Encoder; bodyLengthChecker: (body: any) => number | undefined; credentialDefaultProvider: DefaultCredentialProvider; ... 24 more ...; customUserAgent?: string | ... 1 more ... | undefined; } & ... 5 more ... & UserAgentResolvedConfig' is not assignable to type 'SQSClientResolvedConfig'.
    this.config = _config_6;
    ~~~~~~~~~~~
    at https://deno.land/x/[email protected]/client-sqs/SQSClient.ts:362:5

Found 8 errors.
exited with code 1
Check file:///app/src/index.js

NathanielWroblewski avatar Mar 05 '22 16:03 NathanielWroblewski

I tried rolling back to previous versions all the way to 3.0.0 and no prior version seems to pass the type checker either.

NathanielWroblewski avatar Mar 05 '22 17:03 NathanielWroblewski

Greetings! We’re closing this issue because it has been open a long time and hasn’t been updated in a while and may not be getting the attention it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to comment or open a new issue.

github-actions[bot] avatar Aug 31 '23 00:08 github-actions[bot]