Skip to content

Compatible versions of lambda-api 1.x and aws-sdk 3.x #234

@felipeoriani

Description

@felipeoriani

Hello guys,

I have a node/typescript project running in a lambda and I need to send a file to the client. I am using the lambda-api 1.0.1 and some packages from AWS-SDK 3.x, for example @aws-sdk/lib-storage, @aws-sdk/client-s3 and @aws-sdk/client-api-gateway all in version 3.x.

My code looks like this:

api.get('/export', async (req, res) => { 
   const s3path = getFilePath(); // return "s3://my-bucket/file.pdf"
   res.SendFile(s3path);
});

And when I try to run this request, I got a 500 error.

I got it working after I downgrade to the lambda-api 0.12.0 and install aws-sdk 2.1354.0 (current version). Given the AWS modularized the packages for sdk for each service, what packages should I add in my project to make it work with lambda-api 1.0.1 and read the file from S3 bucket to use response.sendFile?

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions