Skip to content
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

AWS SDK v3 upgrade is a breaking change #332

Closed
icholy opened this issue Dec 9, 2022 · 8 comments
Closed

AWS SDK v3 upgrade is a breaking change #332

icholy opened this issue Dec 9, 2022 · 8 comments

Comments

@icholy
Copy link
Contributor

icholy commented Dec 9, 2022

The switch to AWS SDK v3 is a breaking change and should be behind a new major version.

@juanjoDiaz
Copy link
Owner

Hi @icholy ,

How is the node version upgrade (which includes the upgrade to the v3 of the AWS SDK) affecting you?
The node version and the SDK are internal details of the warmer lambda that is created.
The actual configuration and API doesn't change at all.

@icholy
Copy link
Contributor Author

icholy commented Dec 10, 2022

My projects have sdk v2 listed in their dependencies. The builds start failing with the new version of the warmup plugin because the v3 sdk is missing.

@juanjoDiaz
Copy link
Owner

I see.

When you deploy, you shouldn't have an explicit dependency on AWS SDK since it's already globally installed in all lambdas.
If you are using serverless-offline or some other approach to run locally, then you need to install it and that's probably what you are hitting.

I can agree. That last update can be considered a major version due to that.

@icholy
Copy link
Contributor Author

icholy commented Dec 11, 2022

In my case, it was the webpack serverless plugin failing to resolve the v3 SDK. I only have a rule for excluding the v2 SDK from the bundle.

@juanjoDiaz
Copy link
Owner

I see.

As you probably know the order in which you declare plugins in your serverless.yaml matters.
It's important that you configure serverless-plugin-warmup after webpack or any other plugin that tampers with the lambdas. That way the warmer code won't be transpiled (there is no need to) and it will just work.

@icholy
Copy link
Contributor Author

icholy commented Dec 11, 2022

Changing the plugin order doesn't seem to have an effect. I think this is because the warmers are added in the after:package:initialize hook and the webpack bundling happens in the before:package:createDeploymentArtifact hook which will always happen after.

Adding /@aws-sdk\/.*/ to my webpack externals makes it work though.

@juanjoDiaz
Copy link
Owner

Oh, true that.
Actually, the warmer is re-added on before:package:createDeploymentArtifact just to deal with the webpack plugin modifying and breaking things...

I already told the Serverless guys that they should provide better guidance on the lifecycle events to ensure that plugins use them consistently and we avoid this issues. But it didn't get anywhere. See serverless/serverless#10646

I agree that adding the SDK to externals is the way to go.

@icholy
Copy link
Contributor Author

icholy commented Dec 12, 2022

Thanks for your help with this.

@icholy icholy closed this as completed Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants