Skip to content

[Bug]: When S3.GetObject is called and Body is processed, the equivalent v3 mixins are not added #789

@trivikr

Description

@trivikr

Self-service

  • I'd be willing to implement a fix

Describe the bug

When S3.GetObject is called and Body is processed, the equivalent v3 mixins are not added

Steps to reproduce

import AWS from "aws-sdk";

const client = new AWS.S3();
const params = {
  Bucket: "my-bucket",
  Key: "my-key",
};
const response = await client.getObject(params).promise();

const data = response.Body;

Observed behavior

The data in the transformed code is a Readable Stream and not a buffer.

import { S3 } from "@aws-sdk/client-s3";

const client = new S3();
const params = {
  Bucket: "my-bucket",
  Key: "my-key",
};
const response = await client.getObject(params);

const data = response.Body;

Expected behavior

The Body needs to be transformed from Readable Stream to Buffer.

import { S3 } from "@aws-sdk/client-s3";

const client = new S3();
const params = {
  Bucket: "my-bucket",
  Key: "my-key",
};
const response = await client.getObject(params);

const data = Buffer.from(await response.Body.transformToByteArray());

Environment

aws-sdk-js-codemod: 1.0.5
- jscodeshift: 0.15.2
- recast: 0.23.4

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp2This is a standard priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions