jeremydaly / lambda-warmer

A module to optimize AWS Lambda function cold starts
MIT License
525 stars 55 forks source link

Could not resolve "@aws-sdk/client-lambda" #57

Closed DecioLuczynski closed 1 year ago

DecioLuczynski commented 1 year ago

looks like "@aws-sdk/client-lambda" is a devDependency and needs to be a dependency.

Bundling asset platform-portal-stack/signOutWs/Code/Stage... Error: R] Could not resolve "@aws-sdk/client-lambda"

node_modules/lambda-warmer/lib/lambda-service.js:9:48:
  9 │ ...{ LambdaClient, InvokeCommand } = require('@aws-sdk/client-lambda')
    ╵                                              ~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@aws-sdk/client-lambda" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.

1 error node:child_process:924 throw err; ^

naorpeled commented 1 year ago

Hey @DecioLuczynski, which node version are you running?

DecioLuczynski commented 1 year ago

16.20.1

naorpeled commented 1 year ago

16.20.1

Node 16 comes out of the box with AWS SDK v2. You'd need to install v1 of lambda warmer or upgrade your lambda to use Node 18.

naorpeled commented 1 year ago

Hey @DecioLuczynski, I'll be closing this issue for now.

If you have any questions feel free to ping me.