aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
2.96k stars 556 forks source link

Cannot find package '@aws-sdk/client-s3' in Lambda function with a Layer #6057

Closed keithwhor closed 1 month ago

keithwhor commented 2 months ago

Checkboxes for prior research

Describe the bug

When creating a Lambda Function with a Layer containing nodejs/node_modules, I can no longer access the @aws-sdk v3 inside of my nodejs-20.x functions.

SDK version number

Latest in Lambda

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

20.x

Reproduction Steps

Observed Behavior

Lambda Function throws error; Cannot find package '@aws-sdk/client-s3'

Expected Behavior

Lambda function executes as normal

Possible Solution

Unsure; it seems that mounting a layer unmounts the AWS SDK.

Additional Information/Context

No response

keithwhor commented 2 months ago

I've found that directly importing /var/runtime/node_modules/@aws-sdk/client-s3/dist-cjs/index.js seems to work, but I'm not sure why import resolution doesn't work properly after a layer with node modules is attached?

aBurmeseDev commented 1 month ago

Hi @keithwhor - thanks for reaching out.

I'm going to verify a few things:

github-actions[bot] commented 1 month ago

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

github-actions[bot] commented 4 weeks ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.