serverless-heaven / serverless-aws-alias

Alias support for Serverless 1.x
MIT License
189 stars 68 forks source link

Large Cloudformation Templates (>51,200 Bytes) cause error on alias remove #107

Open mbruning24 opened 6 years ago

mbruning24 commented 6 years ago

We have a particularly large serverless package (~15 functions) and when we try to remove an alias on it, we get the error:

'templateBody' failed to satisfy constraint: Member must have length less than or equal to 51200

It seems to actually remove the alias, but the serverless execution does not run to completion. Is there a way for the plugin to use S3 as a mechanism for CF templates that are really really big?

HyperBrain commented 6 years ago

@mbruning24 Thanks for the report. Oh, I think you're right. Deployment & co use S3 already (in the same way as Serverless does), but remove alias also generates a new CF template for the base stack. I think I just missed to apply the same mechanism there.

It would be great if someone could provide a PR to solve the issue.

dgoradia commented 6 years ago

I hit that same issue today as well. @HyperBrain are you working on this? Not sure where to start on PR myself but if you point me I can give it a go.

HyperBrain commented 6 years ago

@dgoradia Thanks for helping out 👍 . The remove command is a separate file and the specific errorneous line is here: https://github.com/HyperBrain/serverless-aws-alias/blob/master/lib/removeAlias.js#L158

Instead of putting the template into the TemplateBody property, it should be uploaded to S3 (same as with the deploy) and only the S3 object should be referenced there.

mattsemar commented 5 years ago

@HyperBrain I took a stab at this. Would appreciate any feedback. https://github.com/HyperBrain/serverless-aws-alias/pull/150