Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    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
    Vicary A.
    Hi everyone. I'd like to know if it's possible to guarantee s3.getObject() to return the ReadableStream as soon as the connection is made, without having to store the whole file in memories as blob/buffer?
    Sagnik Pradhan
        const s3 = new S3({
          region: options.region,
          credentials: { accessKeyId: options.id, secretAccessKey: options.key },
        console.log(await s3.listObjects({ Bucket: options.bucket }));
    const fromArrayBuffer = (input, offset = 0, length = input.byteLength - offset) => {
    TypeError: Cannot read property 'byteLength' of undefined
        at Object.fromArrayBuffer (D:\Projects\mon-jardin\.yarn\cache\@aws-sdk-util-buffer-from-npm-3.20.0-999309b820-85d99cc391.zip\node_modules\@aws-sdk\util-buffer-from\dist\cjs\index.js:6:60)
        at castSourceData (D:\Projects\mon-jardin\.yarn\cache\@aws-sdk-hash-node-npm-3.20.0-6b212fc65e-c633954411.zip\node_modules\@aws-sdk\hash-node\dist\cjs\index.js:29:31)
        at Hash.update (D:\Projects\mon-jardin\.yarn\cache\@aws-sdk-hash-node-npm-3.20.0-6b212fc65e-c633954411.zip\node_modules\@aws-sdk\hash-node\dist\cjs\index.js:12:26)
    Why could this be happening?
    Paul O'Brien
    Hi, I'm trying to download a file from s3 to a local file but I'm getting a zero byte file with the below code. Any thoughts as to why that might be the case?
    const { S3Client, GetObjectCommand } = require("@aws-sdk/client-s3");
    const { v4: uuidv4 } = require('uuid');
    const client = new S3Client({ region: myRegion });
    const command = new GetObjectCommand({ Bucket: bucket, Key: filename });
    const response = await client.send(command);
    var tmpFile = '/tmp/' + uuidv4() + '.xlsx';            
    Paul O'Brien
    I couldnt get it to work with response.Body.pipe(createWriteStream(tmpFile)) however adding the below helper function worked, doesn't seem right to me though.
            const streamToArray = (stream) =>
                new Promise((resolve, reject) => {
                    const chunks = [];
                    stream.on("data", (chunk) => chunks.push(chunk));
                    stream.on("error", reject);
                    stream.on("end", () => resolve(Buffer.concat(chunks)));
            const bodyContents = await streamToArray(response.Body);
            fs.writeFileSync(tmpFile, bodyContents);
    Michael Heyns

    Hi, does the JS SDK have the concept of session objects? https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html

    I'm trying to port a python library over and would like to instantiate service clients based on previously a acquired session by whatever means (like STS role assumption)

    Kevin Ghadyani

    Howdy! I'm having a lot of trouble with the newer AWS S3 API.

    Quite a few of the apps at work do this:

    aws s3 --acl=bucket-owner-full-control cp --recursive ./storybook-static s3://X.public

    Super simple.

    If I want to do this same action in Node.js, I have to write over 100 lines of code to find the files in the directory recursively, get the contents of each file, assign a content type, and then I can upload to S3.

    That's how I did it with the v2 API. I have absolutely no clue how to do that with v3 and that's my issue today.

    The v3 docs are cryptic. I was hoping the npm package page would provide examples and use cases. After seeing those, I could check the docs knowing what I need to find.

    The way it is now, I have no clue what I'm doing and have spent over an hour trying to figure it out. Also, none of the online discussions are on the v3 API. Seems like no one is using it.

    Is there a way to recursively copy a bunch of files into an S3 bucket?

    Phong Vu
    I got error while using ListObjectsCommand
    let params = {
        Bucket: `myTest`,
        Delimiter: '/'
        Prefix: `asset/${id}/`
      console.log('params: ', JSON.stringify(params));
    try {
        let res = await s3Client.send(
          new ListObjectsCommand(params)
        console.log('res: ', JSON.parse(res));
        return [];
      } catch (e) {
        console.log('getAssets :: getS3Asset :: Error: ' + e);
        return [];
    getS3Asset :: Error: SyntaxError: Unexpected token o in JSON at position 1

    Hello everyone, I have the following issue and I am desparate, I have been trying to solve a trivial issue for days but it doesn't seem like anyone has a same problem. Under this I'll write out the code that gives me the issue.

    import { TextractClient, AnalyzeDocumentCommand,FeatureType } from"@aws-sdk/client-textract"

    function base64ToArrayBuffer(base64) { var binary_string = window.atob(base64);
    var len = binary_string.length;var bytes = new Uint8Array(len);
    for (var i = 0; i < len; i++) { bytes[i] = binary_string.charCodeAt(i);
    }return bytes.buffer;
    const capture=async()=>{console.log('press')
    if (cameraRef.current) { const options = { quality: 0.5, base64: true };
    const data = await cameraRef.current.takePictureAsync(options);try{
    const client = new TextractClient({ region: "us-east-2",credentials:{accessKeyId:process.env.ACCESS_KEY_ID,
    secretAccessKey:process.env.SECRET_ACCESS_KEY} });
    const params = { Document: {
    /**an object specifying Document*/ Bytes:base64ToArrayBuffer(data.base64)
    },FeatureTypes: [
    /**a list of string*/]
    };const command = new AnalyzeDocumentCommand(params)
    let res = await client.send(command)}

    Basically the problem here is when I try to get response from client.send(command) I get error Not implemented. I have no idea why it would be giving me this error. As you can see in the code I'm converting base64 gotten from camera to a uint8array. This code is written in react-native and it says on the official page that this aws package is also for react-native since it works on node.

    Sorry for the bad markdown, I tried to edit it but gitter doesn't let me

    Hello, Iam testing AWS Transcribe but can't get it working. I started with StartTranscriptionJob . This requires a string uri for Media, but I got a blob in Nodejs. Then I switched to StartStreamTranscription . But that requires an AudioStream.

    Is there no API that allows you to send a blob and get the transcription?

    Mario Mendes
    Javascript SDK V3 is a goddamn nightmare to navigate! Great job AWS team, you managed to make looking up methods and their params harder.
    Hi, I'm new in this space and I need a bit of help, I'm setting a rule in an event bus in aws eventbridge using the sdk. I'm also creating an api destination and setting it as target, all that is done with the sdk and without error, but when I send the event the endpoint in the api destination is not being called, I know the rule is working because I also added a cloudwatch log as target to check for that and the events are showing up there. Could someone tell me what are the common places where to look for the issue? I'm struggling to find something online and I have spent a lot of time in this already, really appreciate it if someone can help me.
    1 reply
    Jody Schering
    Hi all, I'm trying to use the js v3 to do a user signup and the documentation isn't clear to me... I have a pool setup its just the javascript side trying to create the CognitoIdentityProviderClient and call the SignupCommand. Can anyone point me to an example of how to do this?
    1 reply
    Matthew Willhite

    Hi—I'm trying to work with the new client-opensearch SDK, but not sure how to build out the request to index my data:

    Given the example in the documentation:

    import * as AWS from "@aws-sdk/client-opensearch";
    const client = new AWS.OpenSearch({ region: "REGION" });
    // async/await.
    try {
      const data = await client.acceptInboundConnection(params);
      // process data.
    } catch (error) {
      // error handling.
    // Promises.
      .then((data) => {
        // process data.
      .catch((error) => {
        // error handling.

    I can't figure out what shape params needs to have. The actual type definition appears to want something like this:

    { ConnectionId: string }

    What should the string value be?

    Where/how do I actually upload my JSON doc?
    Hey all. I'm having issues with error handling when it comes to aws-sdk v3. Where can i see what exceptions can be thrown for specific api calls? Or in general, how should one handle exceptions when it comes to aws-sdk v3?
    Hello everyonee, does anyone have any example on UpdateItemCommand for DynamoDb?
    I cannot find any example anywhere...
    Are there any working examples of using @aws-sdk/client-iot to send/receive over MQTT? I can create/provision an IotThing fine, but I'm unclear on how to use the certificate to connect to the MQTT endpoint (it just hangs indefinitely).
    @meekohi_twitter: you should be using https://github.com/aws/aws-iot-device-sdk-js-v2 for MQTT, afaik @aws-sdk is only for HTTP apis.
    Yes thanks. I did figure that out eventually... it's confusing having a "v3" API that doesn't support a core feature, without any documentation about that ;D
    Jan Schloß
    Hello all, I just migrated to AWS SDK V3 and I wondered how I should type (TypeScript) my Lambda functions if I don't need the lambda client for my application. I see a types packages but it doesn't seem to include types for that. Before i used "@types/aws-lambda"
    Is all type information hidden in the clients? What to do if I only need a type but not the actual client implementation?
    Ken Perkins
    I'm having a nightmare of a time figuring out the right way to have a fargate container in account a using role a1 assume a role b1 in account b using the aws-sdk (javascript). currently I'm using @aws-sdk/client-dynamodb and @aws-sdk/lib-dynamodb and I feel like there's probably a way to tell the client the role to assume
    but there are next to zero examples and the API reference leaves a lot to be desired
    Alex Ware
    Hi, I'm trying to make a kinesis consumer with the v3 sdk, and because of aws/aws-sdk-js-v3#2131 I'm using GetShardIteratorCommand, but it doesn't seem to create a lease, so my TRIM_HORIZON is always trim horizon. The documentation on this is not super good, so I haven't been able to figure out whether GetShardIteratorCommand should get a lease- but there's nowhere obvious to set an application name which the lack of docs implies is the way to get a proper lease.
    Alex Ware
    (Because half of this is kcl functionality and not in the client)
    Hi All, I'm having an issue with responding to websocket clients when a message comes in. I'm trying to send an event to the client using it's connection id. And I'm using aws @aws-sdk/client-apigatewaymanagementapi PostToConnectionCommand. However when this code runs it throws an Invoke Error getaddrinfo ENOTFOUND execute-api.eu-west-1.amazonaws.com. And on the websocket client I get an internal server error message back. Any ideas?