silvermine / serverless-plugin-cloudfront-lambda-edge

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

Long time to re-register a lambda @ edge function to a Cloudfront distribution #44

Closed slanted closed 5 years ago

slanted commented 5 years ago

So when I use your plugin, it deploys the lambda, S3 bucket and Cloudfront distro - which is great.

But now I want to make some changes to the lambda function, and when I re-deploy, the Cloudfront distro takes forever to update to the new version of the lambda function.

I know this isn't your problem. And the lambda function actually updates itself and the reference to the new function version in the Cloudfront distribution very quickly.

But, the Cloudfront distribution stays in the "In progress" state for a very long time. So this makes it so that if I want to make another change and do a 'sls deploy' - the deploy fails because the Cloudfront distro is still in the update state.

It also waits forever until the Cloudfront distro finishes the cloudformation stack update with the new function version. So I usually CTRL-C out of that since the function update is very fast.

Have you found any way around this? When I hack on lambda @ edge functions in the console, I will usually change the function, save it, publish a new version, and then manually update the version in the cloudfront distro behavior and save that.

But I'd rather use your serverless plugin and code locally and do a sls deploy. However the issue I list above makes it so I can do 1 change every 10-15 minutes which is of course a crappy development experience.

jthomerson commented 5 years ago

That's just how long CloudFront takes to guarantee that the change is out. The distribution stays "updating" until they are sure the change is globally rolled out. Even when you do this through the web console, it's doing the same thing (watch the CloudFront status page and you'll see it "updating").