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

Add ability to create clients without passing configuration in TypeScript #3415

Closed
trivikr opened this issue Mar 11, 2022 · 1 comment · Fixed by #5060
Closed

Add ability to create clients without passing configuration in TypeScript #3415

trivikr opened this issue Mar 11, 2022 · 1 comment · Fixed by #5060
Labels
feature-request New feature or enhancement. May require GitHub community feedback. p2 This is a standard priority issue

Comments

@trivikr
Copy link
Member

trivikr commented Mar 11, 2022

Is your feature request related to a problem? Please describe.

The AWS SDK for JavaScript (v3) clients require an empty configuration to be passed in TypeScript.
Such requirement didn't exist in AWS SDK for JavaScript (v2).

Code
import AWS from "aws-sdk"; // v2.1092.0
import { DynamoDB } from "@aws-sdk/client-dynamodb"; // v3.54.0

const v2Client = new AWS.DynamoDB();
const v3Client = new DynamoDB();
ts-node output
/local/home/trivikr/.fnm/node-versions/v16.14.0/installation/lib/node_modules/ts-node/src/index.ts:820
    return new TSError(diagnosticText, diagnosticCodes);
           ^
TSError: ⨯ Unable to compile TypeScript:
listTables.ts:5:18 - error TS2554: Expected 1 arguments, but got 0.

5 const v3Client = new DynamoDB();
                   ~~~~~~~~~~~~~~

  node_modules/@aws-sdk/client-dynamodb/dist-types/DynamoDBClient.d.ts:212:17
    212     constructor(configuration: DynamoDBClientConfig);
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    An argument for 'configuration' was not provided.
Screenshot

client-empty-configuration

The configuration is not actually needed, as client works fine without any value passed in constructor parameters in JavaScript.

Code
import { DynamoDB } from "@aws-sdk/client-dynamodb"; // v3.54.0

const v3Client = new DynamoDB();
console.log(await v3Client.listTables({ Limit: 1 }));
Output
{
  '$metadata': {
    httpStatusCode: 200,
    requestId: 'M6GPIMAI380CVPICA1UTC932VVVV4KQNSO5AEMVJF66Q9ASUAAJG',
    extendedRequestId: undefined,
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  },
  LastEvaluatedTableName: 'TABLE_NAME',
  TableNames: [ 'TABLE_NAME' ]
}

Describe the solution you'd like

Add default parameter as {} for ClientConfig so that clients can be created without explicitly passing {}

Describe alternatives you've considered

N/A

@github-actions
Copy link

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 Aug 23, 2023
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. p2 This is a standard priority issue
Projects
None yet
2 participants