silvermine / serverless-plugin-cloudfront-lambda-edge

Adds Lambda@Edge support to Serverless
MIT License
296 stars 41 forks source link

Add peer dependency on serverless > v2.10.0 #66

Closed tstackhouse closed 3 years ago

tstackhouse commented 3 years ago

This plugin uses serverless.configSchemaHandler.defineFunctionProperties which was added in Serverless 2.10.0 and thus this plugin is incompatible with older versions of the serverless framework, and attempting to do so simply fails with a cryptic error that provides no context: serverless.configSchemaHandler.defineFunctionProperties is not a function.

Adding a peer dependency requirement in the package.json will help enforce compatibility while not forming a hard dependency.

jthomerson commented 3 years ago

@david-gettins any thoughts on this one? You've been using this actively, whereas I haven't had time to upgrade to the new version with config schema yet.

tstackhouse commented 3 years ago

I'd like to revisit using this plugin, I may trying using the old version, I'm just not sure if I can upgrade my app easily from 1.79.0 to the latest 2.x version. We had a recent requirement for adding security headers to our S3+CloudFront hosted UI, which meand we need to use Lambda@Edge, so I've been trying to get the deployment working.

I filed the defect so that others might be able to avoid the same incompatibility. It would be easy enough to make a PR to add that peer dep, and if I can find the time I'll try to do just that.

jthomerson commented 3 years ago

@tstackhouse I just pushed a branch that I think will keep the plugin compatible with old versions of the framework. Could you test it (rather than working on a peer dependency)? This is how you'd install it in your project: (note that you may need to remove the existing dependency from package.json first)

npm i "silvermine/serverless-plugin-cloudfront-lambda-edge#jrthomer/fix-backwards-compat"

The code is in #69

jthomerson commented 3 years ago

@tstackhouse any update?

tstackhouse commented 3 years ago

Haven't had a chance to test it out, did a workaround in my project to use the built in L@E support to get my feature out the door and have been dealing with (unrelated) production fires ever since

j0k3r commented 3 years ago

@jthomerson I can confirm the problem is solved when using your PR.

jthomerson commented 3 years ago

published in + @silvermine/serverless-plugin-cloudfront-lambda-edge@2.2.3

thanks for testing @j0k3r !