-
Notifications
You must be signed in to change notification settings - Fork 597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Cannot find module './aws-sdk' on v3.474.0 of @aws-sdk/credential-provider-node #5594
Comments
Hi @affanshahab, thanks for reporting this issue! The main issue seems to be that the zipped lambda does not contain the complete artifact of the I've taken a look at the published artifacts for I suspect there may be an issue in the specific packaging, installation, caching, or deployment process of your lambda that caused the lambda to not be packaged properly, but I am not able to debug your specific setup and unable to reproduce the issue. Let us know if you have more questions. First, investigating In a previous version In the next version We can confirm this by creating a new project that installs the reported // package.json
{
"dependencies": {
"@aws-sdk/credential-provider-node": "3.474.0"
}
} For this repro, I am using
As seen here in the installation, the Taking a look at the screenshot diff, the inclusion of the
|
My team also ran into this issues with an internal wrapper around Edit: Also seeing this with We see the issue both with lambdas that have a production dependency on v3 clients in node 14 and lambdas that use node 20 runtime but don't bundle it. |
Thanks @syall for looking into it. Just using the v3.470.0 resolved this error for us for now but unfortunately costed me my weekend :( |
@affanshahab Given this info, it sounds like the removal of the |
I just tried this with one of our lambdas and it seems to be working when changing the bundler setting to ignore |
In general, "[t]he bundled SDK is provided as a convenience for developers building simpler functions or using the Lambda console for development". For more complex projects, either 1) only use dependencies included in the Lambda runtime, or 2) fully provide all SDK versions and packages availability in Lambda runtimes are managed by the Lambda team, and are updated periodically with no regular cadence. As a reference, here is a link to all SDK versions currently included in all Lambda runtimes: https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html. |
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. |
Checkboxes for prior research
Describe the bug
Our lambda function was using @aws-sdk/credential-provider-node and in package.json we had:
"@aws-sdk/credential-provider-node": "^3.95.0"
with node 14.x runtime.On Friday 15th Dec 2023 for every new build, our lambda was crashing with following error and stack trace
There were no change in our code so we downloaded the lambda zip from past version and compared the two folders to find out in broken lambda version there were some new files added.
See comparison below and notice node_moduels > @aws_sdk > core > dist-cjs ....: stack trace showing this path
upon investigation it was discovered new version of @aws-sdk/credential-provider-node has introduced this file.
We updated our package.json from
"^3.95.0"
to"3.470.0"
and it solved our problem.SDK version number
3.474.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
node 14.x
Reproduction Steps
use the v3.474.0 of @aws-sdk/credential-provider-node in AWS lambda using node 14.x runtime.
Observed Behavior
Error: Cannot find module './aws-sdk' on v3.474.0 @aws-sdk/credential-provider-node of when using this library in our lambda function running node 14.x.
Expected Behavior
Expected the library to be backward compatible and to be working without crashing
Possible Solution
downgraded to v3.470.0 of @aws-sdk/credential-provider-node
Additional Information/Context
No response
The text was updated successfully, but these errors were encountered: