serverless-aws-alias icon indicating copy to clipboard operation
serverless-aws-alias copied to clipboard

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

Open mbruning24 opened this issue 6 years ago • 4 comments

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?

mbruning24 avatar Mar 06 '18 18:03 mbruning24

@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.

HyperBrain avatar Mar 07 '18 00:03 HyperBrain

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.

dgoradia avatar Jul 02 '18 21:07 dgoradia

@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.

HyperBrain avatar Jul 04 '18 17:07 HyperBrain

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

mattsemar avatar Dec 23 '18 19:12 mattsemar