Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Imaduddin Haetami
    @artidata
    Well, I solve the issue by provisioning higher write capacity of the dynamodb table
    Dean Shelton
    @deanshelton913
    For anyone wondering how to use the new S3 getObject with Readable streams: This worked for me:
    (it's in Typescript but should work with raw JS aswell)
    import { Readable } from 'stream';
    
    const readStream = (stream: Readable): Promise<string> => {
      return new Promise((res, rej) => {
        let data = '';
        stream.on('data', function (chunk) { data += chunk; });
        stream.on('end', function () { res(data); });
        stream.on('error', rej);
      });
    }
    const params = { Bucket, Key };
    logger.debug('S3 getObject >', params);
    const result = (await s3.getObject(params)).Body as any;
    const stream = Readable.from(result);
    return readStream(stream);
    Ognjen Palija
    @misk0
    I've done in this way (NodeJS)
        const response = await s3.getObject({ Bucket: BUCKET, Key: imageName } );
    
        let file_stream = response.Body;
        let content_buffer = Buffer.from([]);
        if (file_stream instanceof Readable) {
            for await (const chunk of file_stream) {
                content_buffer = Buffer.concat([content_buffer,chunk]);
            }
        } else {
            throw new Error('Unknown object stream type.');
        }
    HOK
    @HOKcomics_twitter
    Hi guy
    Hi gals and guys, I'm getting my head arround the new Cognito interface
    I've managed login and some requests, but I'm struggling with security. Any best practices how to preserve a session in a static web application (Java Script using V3 via Webpack) so that my user doesn't have to log in every time he jumps between my various HTML files?
    Cognito side "session" function seems to be gone
    Saving Tokens in browser session seems to break OWASP best practices. Any hint appreciated.
    Eli B. Duhon
    @ebduhon
    I keep getting typescript compilation errors when attempting to use @aws-sdk/client-s3 any suggestions as to which version works?
    to be clear im trying to use it via nodejs
    Eli B. Duhon
    @ebduhon

    I keep getting typescript compilation errors when attempting to use @aws-sdk/client-s3 any suggestions as to which version works?

    After uninstalling all the @aws-sdk packages and reinstalling @aws-sdk/client-s3-node works but @aws-sdk/client-sqs no longer works and I am getting Typescript errors when attempting to use the ListQueuesCommand. ListQueuesCommand incorrectly implements interface 'Command...

    to be clear i am attempting to now use the @aws-sdk/client-sqs-node package
    Eli B. Duhon
    @ebduhon
    Are there any stable AWS-SDK V3 for JavaScript & Node.js packages?
    Eli B. Duhon
    @ebduhon
    S3CreateBucketCommand LocationConstraint does not default to "us-east-1" as indicated by the API docs and must be specified otherwise an error InvalidLocationConstraint occurs
    Emanuele Fumagalli
    @emanuelef
    Hi, I'm using the sdk 3 with DynamoDB. How is it possible to specify the endpoint when using dynamoDB running in Docker?
    Emanuele Fumagalli
    @emanuelef
    I just needed to add endpoint to DynamoDBClient
    const client = new DynamoDBClient({
    region: "us-east-1",
    endpoint: "http://localhost:8001",
    });
    Gerard Downes
    @GDownes
    Hi, I've just started using the client. Amazing work. The below util was great for simplifying the PutItemCommand.
    const { marshall } = require("@aws-sdk/util-dynamodb");
    Currently stuck on creating the UpdateItemCommand key parameter.
    I'm looking for an example of using the UpdateItemCommand. Any pointers/resource would be greatly appreciated.
    langell
    @langell
    @laurisvan I'm having the same issue with serverless invoke local and aws-sdk v3.
    error - Profile xxxxxxxxx requires a role to be assumed, but no role assumption callback was provided.
    did you ever solve your problem?
    Eli B. Duhon
    @ebduhon
    @aws-sdk/client-dynamodb-node is missing the command TransactGetItemsCommand and TransactWriteItemsCommand
    Oliver
    @or
    Hello, folks. I'm trying to figure out how to turn on debug logging for the S3 client (I suspect any client would work the same way) in AWS SDK v3 for JS, so I can troubleshoot an issue I have. I couldn't find the right piece of documentation. Can anyone point me in the right direction?
    Oliver
    @or
    I tried setting https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/interfaces/clientdefaults.html#logger to {debug: some_function}, but that didn't have the desired effect.
    Ok, now that works. I guess it was a stale client object. Never mind!
    Filip Figiel
    @megapctr
    I'm writing a middleware for the deserialize step. I receive a HttpRequest object, but I have no idea how to send it to get the response. Please help?
    before upgrading to v3, the v2 results had a $response field I could use instead of writing a middleware
    Filip Figiel
    @megapctr
    solved using axios, aws4 package and browser xml parser. My app serves handles non-standard IAM actions so I had most of these already in place
    Raymond Feng
    @raymondfeng
    Hi, does @aws-sdk/client-dynamodb allow use of @aws-sdk/client-dax?
    musheyev
    @musheyev
    Does anyone have an example of how to supply parameters to authenticate a user with cognito?
    const { CognitoIdentityClient, CreateIdentityPoolCommand } = require("@aws-sdk/client-cognito-identity");
    
    const client = new CognitoIdentityClient({ region: "us-east-1" });
    
    const params = {
        /** input parameters.  Example? */
      };
    
      const command = new CreateIdentityPoolCommand(params);
    
      client
      .send(command)
      .then((data) => {
        // process data.
      })
      .catch((error) => {
        // error handling.
        const { requestId, cfId, extendedRequestId } = error.$metadata;
        console.log({ requestId, cfId, extendedRequestId });
      })
      .finally(() => {
        // finally.
      });
    Jan Brauer
    @iwt-janbrauer
    Why doesn't unmarshall from @aws-sdk/util-dynamodb take a type argument like unmarshall<Foo>(item). That would be extremely helpful. Currently it's kind of hard to put the thing I get back from unmarshall to use.
    Also, did somebody succeed in getting https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/aws-lambda/trigger/dynamodb-stream.d.ts to work with unmarshall? I had to put this everywhere:
                    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
                    // @ts-ignore Property '$unknown' is missing in type.
                    const payload: Payload = unmarshall(newImage);
    Joel V
    @JoelV

    Hello I'm having trouble accessing the AWS namespace for v3. I want to do the following here to setup kms from a RoleArn:

    const AWS = require('@aws-sdk/client-kms');
    AWS.config.credentials = new AWS.ChainableTemporaryCredentials({
          RoleArn: 'foo'
        });
     kms = new AWS.KMS({
          region: 'us-east-1'
        });

    I can't figure out what package to install from npm to get to the new AWS.ChainableTemporaryCredentials constructor

    Miroslav Kovar
    @mirgee
    Hello there, can somebody please advise on how to log aws api requests? It is very handy in debugging.
    1 reply
    Jeffrey Tanner
    @jeff00seattle

    I am converting AWS Polly code in Javascript (node) from v2 to v3.

    Using SynthesizeSpeechCommand using OutputFormat: 'mp3', I am expecting response data.AudioStream to an instance of Buffer, but it is not:

    IncomingMessage {
      _readableState:
       ReadableState {
         objectMode: false,
         ***
    3 replies
    Joe Stead
    @JoeStead

    Hey folks, has anyone seen issues with the sdk and using jest? I have a test which looks like this:

    import { LambdaClient, ListFunctionsCommand } from "@aws-sdk/client-lambda";
    
    it("ffs", async () => {
      const lambda = new LambdaClient({
        region: "eu-west-1",
      });
      const response = await lambda.send(new ListFunctionsCommand({}));
    
      console.log(response.Functions);
    });

    The test passes, but jest hangs with the output "Jest did not exit one second after the test run has completed. This usually means that there are asynchronous operations that weren't stopped in your tests."

    I've tried destroying the client at the end of the test / in an afterAll block to no success.

    This is only happening when running in our gitlab CI build (using the node12 base image from docker) and on windows. On my Mac it's absolutely fine. Any ideas?

    3 replies
    It feels like something in the client is leaking, that my Mac doesn't care about but I have no way of verifying this
    Andrew Luetgers
    @andrewluetgers
    Hey all, finding the transition on some basic s3 object operations a bit frustrating. I must be missing something. First I am finding the new api docs a bit less than helpful. For example put object, https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/classes/putobjectcommand.html where can I find a basic usage example in any of the docs of a put object? Furthermore where can I find what the valid input attributes are to the command? Like I said I'm sure I'm missing something but it feels like the docs are extremely thick on words about all the nooks and crannies of functionality but for the 75% use case most people will just want to see some working code example and a list of command options. Instead it feels like that is not easy to find at all and we dive right into all the nitty gritty details.
    The second problem I have is quite odd as well, I know I'm accessing my object but when I try to console.log the body it seems to be some kind of client/transport wrapper object, having a hard time just logging the contents of a text file on get object sheesh some days I feel like I'm in the wrong line of work
    waleedshkt
    @waleedshkt
    Hey Andrew,
    You can refer to v2 sdk docs for examples. The newer v3 sdk just changes the way you instantiate the client and commands, and send them.
    Rest is pretty much the same
    Andrew Luetgers
    @andrewluetgers
    Ahh I see my problem for getObject, as noted earlier Body.toString('utf-8') seems not to work and requires concating the readable stream into a new buffer then calling buffer.toString("utf-8")
    Pier-Luc Gagnon
    @pierlucg-xs

    I'm trying to use STS client to debug how the SDK is set up (since we can use AWS_PROFILE and others to change how the SDK is authenticated), and I'm hitting the following issue:

    ProviderError: Profile foo requires a role to be assumed, but no role assumption callback was provided.

    the code is trivial:

    const sts = new STSClient({region: 'us-east-1'});
    const callerIdentity = await sts.send(new GetCallerIdentityCommand({}));
    logger.info(callerIdentity);
    Pier-Luc Gagnon
    @pierlucg-xs
    The equivalent v2 code works as expected:
    const sts = new STS({region: 'us-east-1'});
    const callerIdentity = await sts.getCallerIdentity().promise();
    logger.info(callerIdentity.arn); // arn:aws:sts::123456789012:assumed-role/foo/aws-sdk-js-0000000000000
    Lonny Angell
    @langell_gitlab
    @pierlucg-xs getting the same issue
    @pierlucg-xs same issue with assume role callback. Happens in v3 and only in offline mode for us. We ended up switching back to v2 until this is fixed
    Pier-Luc Gagnon
    @pierlucg-xs
    Same, stuck with V2
    Nick Polanco
    @nhpolanco

    Hey all, there's no MobileAnalytics client in the v3 sdk similar to the one in v2 (see service here: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/MobileAnalytics.html )

    Is it still on the roadmap, yet to be released, or has it been replaced with another client which I can use to put analytics events to a pinpoint project?

    Daniel Whitford
    @shaftoe44
    Hi all, I am trying to find a way to stream/pipe to S3. At the moment I am using PutObjectCommand with a Buffer as the body but I am getting memory issues and it would be much nicer to be able to use pipe() or a WriteableStream somehow. I have found some examples using v2 but not sure how to convert them using v3. Any ideas much appreciated!
    kerruba-milkman
    @kerruba-milkman

    Hello here, I'm trying to build a typescript project using v3, but during build time I get errors like these:

    node_modules/@aws-sdk/util-dynamodb/types/models.d.ts:19:59 - error TS2304: Cannot find name 'Blob'.

    Any idea?

    Molly
    @dermolly:kif.rocks
    [m]
    Hey,