juanjoDiaz / serverless-plugin-warmup

Keep your lambdas warm during winter. ♨
MIT License
1.11k stars 115 forks source link

Is @aws-sdk/client-lambda now a peer dependency? #333

Closed agawley closed 1 year ago

agawley commented 1 year ago

I'm getting an error compiling after moving to 8.2.1

Module not found: Error: Can't resolve '@aws-sdk/client-lambda' in '~/code/serverless/dinghyrace-app/.warmup/apiWarmer'

Looks like as of this change https://github.com/juanjoDiaz/serverless-plugin-warmup/commit/bdb983f628b37573d0162a71c122b3ac1bab6a4f it will be required. Just checking as I was surprised by this failure. (I know I should be using the v3 API in my serverless app, but I just haven't got round to migrating...)

juanjoDiaz commented 1 year ago

Hi @agawley ,

Sorry for the slow response.

8.2.1 Latest updates the warmer lambda to node18. Node18 lambdas automatically include the v3 SDK instead of the v2.

It seems that you are doing some sort of bundling. If so, AWS SDK should be excluded since it's included by default in all lambdas. Not including the SDK in the lambda helps getting smaller lambas with faster startup time.

If you really want to package it for whatever reason you need to have it as a peer-dependency just as you probably have the v2 SDK at the moment.

agawley commented 1 year ago

Awesome. Thanks. I've now migrated to v3, so will also migrate to Node 18 and then remove v3 from the bundle. Thanks.