-
Notifications
You must be signed in to change notification settings - Fork 604
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
'@smithy/node-http-handler' not included in lambda Node.js 20.x runtime #6169
Comments
Hi @mellster2012 - thanks for reaching out. Can you verify if you've installed smithy/node-http-handler in your packages?
|
@mellster2012 - this's reproducible when running code in Lambda provided SDK and we were able to confirm it. Please use the shortened syntax to configure requestHandler until fix is released. (ref: P135205927) // Example: short form requestHandler configuration.
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
const client = new DynamoDBClient({
requestHandler: {
requestTimeout: 3_000,
httpsAgent: { maxSockets: 25 },
},
}); |
https://docs.aws.amazon.com/lambda/latest/operatorguide/sdks-functions.html The AWS Lambda provided AWS SDK for JavaScript is only updated periodically, and may be missing features that the most recent AWS SDK version contains. When it does update, it is done automatically without a way to opt-out. Therefore, in addition to the workaround shown above, for stability in production usage you should provide your own AWS SDK version as part of your uploaded application. |
Providing the missing/additional dependency explicitly in package.json doesn't work either, though. Do you have to add an option to bundle your own AWS, such as mentioned here: aws/aws-cdk#25492 ? And is there a way to instruct it to take the currently provided AWS SDK at runtime and add a few extra dependencies found in package.json, or do you have to either provide your (entire) own custom AWS SDK or nothing? |
Can you elaborate more on that or share what you did with repro code? I've confirmed the workaround mentioned above with providing @smithy/node-http-handler dependency works. Let us know if we're missing something. |
You are right, I missed that Code.fromAsset does not automatically bundle additional dependencies outside of the lambda handler folder. We can keep using @aws-sdk/node-http-handler (which is working fine) and wait until @smithy/node-http-handler is included or switch the build process for the affected lambda and include @smithy/node-http-handler as a dependency. Thank you! |
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
The documentation at https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md#request-handler-requesthandler says to use '@smithy/node-http-handler' but the lambda fails with
"errorMessage": "Cannot find package '@smithy/node-http-handler' imported from /var/task/index.mjs", "code": "ERR_MODULE_NOT_FOUND"
, regardless of whether the module is specified as a dependency in package.json or not.SDK version number
@aws-sdk/client-s3 3.4x and 3.5x
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
Node.js v20
Reproduction Steps
Observed Behavior
Expected Behavior
Module should be found.
Possible Solution
Workaround is to use
import { NodeHttpHandler } from '@aws-sdk/node-http-handler';
instead.
Additional Information/Context
No response
The text was updated successfully, but these errors were encountered: