Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Nitron App
    Is there a way to get the total number of pages with @aws-sdk/client-cognito-identity-provider -> ListUsersCommand response?
    @clindsey set env variables in lambda config, and call them using native node process.env way. Are you using async/ await? If so, use try/catch to capture an error. Hope it helps
    @nitron-app Yes you can. It's returned as 'PaginationToken' under data object in response
    @nitron-app Apologies I misread your query. There's no inbuilt way to get pages count. Unless you know initially the total number of users, you can set the limit property in listUsers params to (let say) 100 and calculate the pages this way. Or if total users are unknown, then there's no way other than subsequent calling of listUsers api with previous page Pagination Token prop in the request param until this prop is returned 'null' in the response
    not important
    @waleedshkt during the bundling process i need to inject env variables for the app, that's why i'm using defineplugin from webpack. Capturing the error just gives TimeoutError with absolutely no other info, but there's an open ticket on the sdk about that already. As my 2nd message said, the problem is already fixed, thanks for reply
    Alright. Great
    Hi, is it just me that feels that the docs for v3 is not very helpful in using the apis there? Compared to v2, there are always example / formats after every method so I can get a brief understanding of how to construct the inputs to the commands. I have to use 3 different sources of docs in order to figure out.. the v2, v3, and the api doc for the service on aws docs. How did you all do it or any feedback to the aws team who wrote the v3 docs?
    Nitron App

    Hi, is it just me that feels that the docs for v3 is not very helpful in using the apis there? Compared to v2, there are always example / formats after every method so I can get a brief understanding of how to construct the inputs to the commands. I have to use 3 different sources of docs in order to figure out.. the v2, v3, and the api doc for the service on aws docs. How did you all do it or any feedback to the aws team who wrote the v3 docs?

    Totally agree!

    @waleedshkt Thanks for your reply.
    Trying to determine if this is a lack of knowledge on my side, or if there is a typing issue. @aws-sdk/client-secrets-manager > GetSecretValueCommand > GetSecretValueResponse > SecretBinary. The description says it is a base64 encoded string, but the type is defined as a Uint8Array. Any assistance or an example of the actual response would be appreciated.
    YuChao Liang
    Hi, I'm using @aws-sdk/client-s3 how can I check if the secret configuration is valid after S3Client initialized.
    Attila Večerek

    Hello :wave: Does anyone here know the difference between a null Messages and a [] Messages in the SQS client’s ReceiveMessageResult?

    I’m trying to figure out if the two represent the same thing, i.e. there are no messages to consume, or nullreflects some kind of an error, in which case what error would that be?

    Hey everyone!
    I have problems with KinesisClient package.
    I am trying to do the request with SubscribeToShardCommand with all required params.
    However once request is sent - the promise is stuck and nothing happens.
    Can anyone please share some sample for SubscribeToShardCommand?
    Or maybe also had similar issue
    Can anyone aid me with Cognito (possible bug spotted)?
    I need to access what group the logged in user has. In v2 this was part of the payload received in the login response. In v3 I can't find it there. I tried the ListAccountRolesCommand (documentation is mit clear to me, but I assume this is for IAM Roles, anyway I tried). It's documented in both, CognitoIdentity and CognitoIdentityProvider. Both fail in my setup (Browser/Webpack) with a "Type Error: m is not a constructor". Identical Sytax with other commands (like SignUpCommand, GetUserCommand and many more) worked properly.
    Thomas Nolan
    Hey, I've just started using the @aws-sdk/client-ec2 module. Is there a way I can create an EC2 with a public IP address through the SDK? I've read through the tutorial about how to assign one through using AllocateAddressCommand and AssociateAddressCommand but is there a parameter I can supply to RunInstancesCommand that will do it automatically? Any help appreciated, thank you.
    Daniele Tortora

    Hi all, I have a list of redirects that is generated programmatically for a website hosted on S3. Until now we have (incorrectly) done client-side redirects, and I wanted to use aws-sdk to push this list to S3 every time we deploy.

    I cannot find any guide online on how to setup the SDK for this purpose and the only command that seems pointing at this is PutObjectCommand so I've created the following:

    const s3 = new S3Client({ region: REGION });
    function creatPutObjectCommand(from: string, to: string) {
      return new PutObjectCommand({
        WebsiteRedirectLocation: from,
        Body: '',
        Bucket: BUCKET,
        Key: to,
    redirects.forEach(({ source, destination }) => {
        const command = creatPutObjectCommand(source, destination);
          .then(() => {
            log(`Redirection from '${source}' to '${destination}' uploaded to S3.`);
          .catch(error => {
            log(`🔺 Error while uploading to S3. Source: ${source}. Destination ${destination}`);

    Does that look correct? Can you guys point me to some docs/guide on how to set this up?


    Hi. I'm trying to perform a transaction but I'm seeing this error:

    Type 'TransactWriteItemsCommandOutput' is not assignable to type 'UpdateItemCommandOutput'.
    Type 'TransactWriteItemsCommandOutput' is not assignable to type 'UpdateItemOutput'.
    Types of property 'ConsumedCapacity' are incompatible.
    Type 'ConsumedCapacity[] | undefined' is not assignable to type 'ConsumedCapacity | undefined'.
    Type 'ConsumedCapacity[]' has no properties in common with type 'ConsumedCapacity'.

    I am sending the commandthis.client.send(new TransactWriteItemsCommand({ ... }))

    Is this a bug or am I doing something wrong? Thanks!

    Hi. I am trying to create a redshift cluster, but i am getting AccessDenied 403 as an error, are my credentials not working here?
    const { RedshiftClient, CreateClusterCommand} = require("@aws-sdk/client-redshift");
    const { CognitoIdentityClient } = require("@aws-sdk/client-cognito-identity");
    const { fromCognitoIdentityPool } = require("@aws-sdk/credential-provider-cognito-identity");
    const REGION = "us-east-2";
    const redClient = new RedshiftClient({
        region:  REGION,
        credentials: fromCognitoIdentityPool({
            client: new CognitoIdentityClient({ region: REGION}),
            identityPoolId: "us-east-2:00000000................"
    const params = {
        ClusterIdentifier: "myexamplesdkcluster",
        MasterUserPassword: "Password123",
        MasterUsername: "awsuser",
        NodeType: "dc2.large"
    const command = new CreateClusterCommand(params)
    const redshiftFunc = async ()=> {
        const redShiftView = await redClient.send(command, (err,data) => {
    Hi everyone, I'm trying to use AWS SDK v3 through a company proxy; I configured a proxy, by setting the NodeRequestHandler as described here: https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-proxies.html. My credentials are passed from config/credentials file. However I need to assume an role. When STS calls assume role, I get an error that indicates that the proxy is not used for the STS call: Failed to run: Error: getaddrinfo ENOTFOUND sts.eu-central-1.amazonaws.com
    Any ideas how to work around that?
    I also tried overwriting the credentials with code lkie this:
        credentials: fromIni({
                    profile: 'myprofile',
                    roleAssumer: (sourceCreds, params1): Promise<Credentials> => {
                        const stsClient = new STSClient({
                            requestHandler: new NodeHttpHandler({
                                httpAgent: params.settings?.proxyAgent,
                            credentials: sourceCreds,
                        return stsClient.send(new AssumeRoleCommand(params1)).then((output) => ({
                            accessKeyId: nullSafe(output.Credentials?.AccessKeyId),
                            secretAccessKey: nullSafe(output.Credentials?.SecretAccessKey),
                            sessionToken: output.Credentials?.SessionToken,
                            expiration: output.Credentials?.Expiration,
    sourceCreds are parsed correctly, however also the same error as above
    In the documentation, the agent is set like this: httpAgent: new Agent({ proxy: proxy("http://internal.proxy.com") }),
    however http.AgentOptions does not have a proxy field
    I got it to work:
    requestHandler: new NodeHttpHandler({
                                httpsAgent: proxy(),
    but it is necessary to also instantiate the STS client
    so a) the documentation is wrong, and b) I think it's a bug that the proxy settings are not passed on to the default STSClient
    Hi, does anybody know where I could find the types needed for lambda handler function parameters? For instance: SQSEvent, Context, etc?
    Ignat Zapolsky
    Hi. Can anyone explain how to consume downleveled @aws-sdk ? We are using typescript 3.9.x and it breaks with 3.13.1 and 3.12.0 versions. I've checked aws-sdk/types/dist folder and it does not have 3.4 downleveled definitions
    I am seeing following error:
    node_modules/@aws-sdk/types/dist/types/util.d.ts:92:42 - error TS1005: ',' expected.
    92 export declare type UserAgentPair = [name: string, version?: string];
    node_modules/@aws-sdk/types/dist/types/util.d.ts:92:60 - error TS1005: ',' expected.
    92 export declare type UserAgentPair = [name: string, version?: string];
    Found 2 errors.

    Hello everyone! I have a trouble using the @aws-sdk/client-eventbridge. I've already added my rule following this event pattern where my target resource is a Lambda Function.:

    "source": ["shop.list.test"],
    "detail-type": ["testing event bridge"],
    "detail": ["Hello wolrd!"]

    So I try to put the event with @aws-sdk/client-eventbridge using Node.js:

    const { EventBridgeClient, PutEventsCommand } = require("@aws-sdk/client-eventbridge");
    const client = new EventBridgeClient({ region: "us-east-1" });

    const json = JSON.stringify({
    message: "Hello wolrd!"
    const command = new PutEventsCommand({"Entries": [
    {DetailType: "testing event bridge", Source: "shop.list.test", Detail: json}

    async function main() {
    const data = await client.send(command);
    console.log("data => ", data);


    And I receive the successful status from event-bridge then the lambda would trigger but isn't. Any advice?

    Saravanakumar GS
    I am using the client-transcribe-streaming, getting websocket-handler.ts:101 WebSocket is already in CLOSING or CLOSED state while sending the StartMedicalStreamTranscriptionCommand.

    Hello everyone
    What's the correct way to get an object as a stream with the @aws-sdk/client-s3 ?
    I'm trying to do something like this in TypeScript:

      const cmd = new GetObjectCommand(params);
      const res: GetObjectCommandOutput = await s3.send(cmd);
      const writer = fs.createWriteStream(filename);

    But the Body doesn't have a pipe method...

    Arpit Yadav
    Hey, Is there any way to get base64 instead of Uint8Array from encrypt @aws-sdk/client-kms and get the exact data from decrypt
    Kunal Parikh
    Screen Shot 2021-06-04 at 3.04.24 PM.png

    :wave: folks!

    I'm trying to load the s3 client directly in the browser using unpkg

    import { S3Client, AbortMultipartUploadCommand } from "https://unpkg.com/@aws-sdk/client-s3@3.17.0/dist/es/index.js?module";

    While some of it works, I do get some errors (screenshot attached - above)

    Any thoughts on a workaround for these errors?
    James Gisler
    Can anyone here post a link with more info regarding capturing trace data from the aws-sdk-v3 clients using aws-xray?
    Scott Finlayson
    @reberthkss do you have any triggers set up against the lambda function? Check out the lambda function > Configuration > Triggers and you should see EventBridge. If not then you've not added the rule correctly which would explain why the lambda isn't triggering.
    Deepak Bhat

    Can anyone help with this error I'm getting when I use ListObjectVersionsCommand.
    The docker image works fine in my local, but when deployed to EKS it fails with the following error -
    {"stack":"Error: getaddrinfo ENOTFOUND s3.us-east-1.amazonaws.com\n at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:69:26)","type":"Error","msg":"getaddrinfo ENOTFOUND s3.us-east-1.amazonaws.com"}

    Not sure if this additional information helps, but this is called within a Next JS app.

    The code that is being used to make this call is as follows -

    const s3 = new S3Client({
      region: "us-east-1",
      credentials: {
        accessKeyId: process.env.AWS_ACCESS_KEY_ID,
        secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
    const data = await s3.send(new ListObjectVersionsCommand({ Bucket: process.env.CLASSIC_PROGRAMS_BUCKET }));
    Scott Finlayson
    @dbhat6 looks like a DNS issue. Does the container have DNS configured correctly? You can use dig or nslookup to check the response from the DNS server
    Deepak Bhat
    Thanks, @scottfinlayson . I will check on that aspect