jeremydaly / lambda-api

Lightweight web framework for your serverless applications

Home Page:https://serverless-api.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

felipeoriani opened this issue · comments

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

Hey @felipeoriani

thanks for opening this issue!

I think I've found the root cause for the 500 error.
Will look further into it tomorrow and keep you updated with the progress 🙏

Hello @naorpeled

I just downgrande the version of the lambda-api to 0.12.0 and aws-sdk to 2.x and it worked. It would be great to have a fix for it on lambda-api 1.x.

Thank you!

Hello @naorpeled

I just downgrande the version of the lambda-api to 0.12.0 and aws-sdk to 2.x and it worked. It would be great to have a fix for it on lambda-api 1.x.

Thank you!

Hey,
I'm sorry, I didn't get to it yet :(

I want to push a fix after throughly testing it

Hey @felipeoriani I found the root cause and did some testing that seems to work,
tomorrow will fix the tests and re-review my solution (#236) and hopefully release the new version.

Sorry for the huge delay 🙏