Skip to content

Validation error with more than 50 parameters #3757

@dave-kennedy

Description

@dave-kennedy

I didn't find this issue in the backlog.

Description:

My template has 53 parameters. sam validate throws this error:

% sam validate
2022-03-18 12:13:00 Loading policies from IAM...
2022-03-18 12:13:03 Finished loading policies from IAM.
2022-03-18 12:13:03 Template schema validation reported the following errors: [, P, a, r, a, m, e, t, e, r, s, ],  , O, r, d, e, r, e, d, D, i, c, t, (, [, (, ', A, w, s, R, e, g, i, o, n, ', ,,  , O, r, d, e, r, e, d, D, i, c, t, (, [, (, ', T, y, p, e, ', ,,  , ', S, t, r, i, n, g, ', ), ,,  , (, ', D, e, s, c, r, i, p, t, i, o, n, ', ,,  , ', A, W, S,  , R, e, g, i, o, n,  , b, e, i, n, g,  , u, s, e, d, ', ), ,,  , (, ', D, e, f, a, u, l, t, ', ,,  , ', u, s, -, e, a, s, t, -, 1, ', ), ], ), )...

I know the spaces in the error message are due to #3493 (still waiting on aws/serverless-application-model#2245). That's not the issue. This is what it looks like without the spaces (and with added line breaks):

[Parameters]
OrderedDict(
    [
        (
            'AwsRegion',
            OrderedDict(
                [
                    ('Type', 'String'),
                    ('Description', 'AWS Region being used'),
                    ('Default', 'us-east-1')
                ]
            )
        ),
        [a bunch of other properties here...],
    ]
) has too many properties

The error at the bottom is the relevant part. Removing any three of the parameters makes this error go away.

Steps to reproduce:

  1. Run sam validate on a template with more than 50 parameters.

Observed result:

Validation error: [Parameters] OrderedDict... has too many properties

Expected result:

CloudFormation supposedly supports up to 200 parameters, so it should validate.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: MacOS 11.6.4
  2. sam --version: 1.40.1
  3. AWS region: us-east-1

Add --debug flag to command you are running

% sam validate --debug
2022-03-18 12:45:56,928 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2022-03-18 12:45:56,928 | Using config file: samconfig.toml, config environment: default
2022-03-18 12:45:56,928 | Expand command line arguments to:
2022-03-18 12:45:56,928 | --template_file=/Users/dave.kennedy/sam-api/template.yaml
2022-03-18 12:45:57 Loading policies from IAM...
2022-03-18 12:45:59 Finished loading policies from IAM.
2022-03-18 12:45:59 Template schema validation reported the following errors: [, P, a, r, a, m, e, t, e, r, s, ],  , O, r, d, e, r, e, d, D, i, c, t, (, [, (, ', A, w, s, R, e, g, i, o, n, ', ,,  , O, r, d, e, r, e, d, D, i, c, t, (, [, (, ', T, y, p, e, ', ,,  , ', S, t, r, i, n, g, ', ), ,,  , (, ', D, e, s, c, r, i, p, t, i, o, n, ', ,,  , ', A, W, S,  , R, e, g, i, o, n,  , b, e, i, n, g,  , u, s, e, d, ', )...
2022-03-18 12:45:59,425 | Translated template is:
AWSTemplateFormatVersion: '2010-09-09'
Description: SAM API template
Parameters:
  AwsRegion:
    Type: String
    Description: AWS Region being used
    Default: us-east-1
...

/Users/dave.kennedy/sam-api/template.yaml is a valid SAM Template
2022-03-18 12:45:59 There are unpublished metrics. Please make sure you call publish after you record all metrics.
2022-03-18 12:45:59 There are unpublished metrics. Please make sure you call publish after you record all metrics.

I can't disclose the entire template, hope that isn't a problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions