eugene-manuilov / cfpack

A CLI tool that helps to build CloudFormation template using multiple smaller templates.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

false-positive JSON size error from AWS

arjanvandervelde opened this issue · comments

Hi!

When validating templates as part of the 'build' task, the built template JSON gets prettified, increasing its size considerably. I noticed that for some of my larger templates it may grow by a factor of 2. The obvious fix would be to remove the two extra parameters from the call to JSON.stringify(), but that would leave us with pretty ugly error messages should validation fail for reasons other than size. Perhaps conditionally run it without these options for larger templates?

Thanks!

-- Arjan

see:

cloudformation.validateTemplate({ TemplateBody: JSON.stringify(this.output.template, '', 4) }, (err) => {

@arjanvandervelde I have just released a new version (1.5.1). It checks whether the prettified template is too big before sending it for verification and fallbacks to the non-prettified version if it exceeds 51200 bytes. Hope it helps to solve this issue. Can you try it on your end and let me know if it works for you?

@eugene-manuilov thanks! I'll test the new version asap and get back to you.

ok, it works as expected, 17b49fd fixed this issue. thanks!