Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

TypeError: Cannot convert undefined or null to object #188

Open
john-aws opened this issue Aug 10, 2018 · 1 comment
Open

TypeError: Cannot convert undefined or null to object #188

john-aws opened this issue Aug 10, 2018 · 1 comment

Comments

@john-aws
Copy link

A YAML template with the following:

AvailabilityZone: !Select [ 0, !GetAZs ]

causes the following internal error:

Unable to parse template! Use --verbose for more information.
TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at doIntrinsicGetAZs (/Users/john/.nvm/versions/node/v8.10.0/lib/node_modules/cfn-lint/src/validator.ts:812:26)
    at resolveIntrinsicFunction (/Users/john/.nvm/versions/node/v8.10.0/lib/node_modules/cfn-lint/src/validator.ts:667:20)
    at doIntrinsicSelect (/Users/john/.nvm/versions/node/v8.10.0/lib/node_modules/cfn-lint/src/validator.ts:892:24)
    at resolveIntrinsicFunction (/Users/john/.nvm/versions/node/v8.10.0/lib/node_modules/cfn-lint/src/validator.ts:681:20)
    at recursiveDecent (/Users/john/.nvm/versions/node/v8.10.0/lib/node_modules/cfn-lint/src/validator.ts:606:38)
    at recursiveDecent (/Users/john/.nvm/versions/node/v8.10.0/lib/node_modules/cfn-lint/src/validator.ts:616:13)
    at recursiveDecent (/Users/john/.nvm/versions/node/v8.10.0/lib/node_modules/cfn-lint/src/validator.ts:616:13)
    at recursiveDecent (/Users/john/.nvm/versions/node/v8.10.0/lib/node_modules/cfn-lint/src/validator.ts:616:13)
    at recursiveDecent (/Users/john/.nvm/versions/node/v8.10.0/lib/node_modules/cfn-lint/src/validator.ts:616:13)

The provided GetAZs construct is accepted by CloudFormation.

@martysweet martysweet added the bug label Aug 22, 2018
@martysweet
Copy link
Owner

This should just be a case of picking up this edge case within the doIntrinsicGetAZs method. This version of the shorthand is currently not taken into account.

https://github.com/martysweet/cfn-lint/blob/master/src/validator.ts#L810-L811

Something like

if is an argument is actually present
 process argument (current code)
else don't bother with arguments
 current else statement

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants