cfn-config icon indicating copy to clipboard operation
cfn-config copied to clipboard

stuck when AllowedValues for Type number is present

Open jjanczyszyn opened this issue 5 years ago • 2 comments

Tried deploying a stack after adding an additional parameter with type: Number and AllowedValues provided:

e.g.

    LuckyNumber: {
      Type: 'Nuber',
      AllowedValues: [0,1,2,3,4,5,6,7,8,9,10]
    }

the stack update gets stuck before asking for LuckyNumber - it hangs until I stop the process and then it shows TypeError: Cannot use 'in' operator to search for 'value' in 0

I was able to reproduce this with two different repos. After removing AllowedValues I was able to deploy without problems.

full stacktrace
TypeError: Cannot use 'in' operator to search for 'value' in 0
    at new Choice (/Users/justynajanczyszyn/REPOS/mapbox/mbxcli/node_modules/@mapbox/cfn-config/node_modules/inquirer/lib/objects/choice.js:26:24)
    at Choices.choices.choices.map.val (/Users/justynajanczyszyn/REPOS/mapbox/mbxcli/node_modules/@mapbox/cfn-config/node_modules/inquirer/lib/objects/choices.js:23:14)
    at Array.map (<anonymous>)
    at new Choices (/Users/justynajanczyszyn/REPOS/mapbox/mbxcli/node_modules/@mapbox/cfn-config/node_modules/inquirer/lib/objects/choices.js:16:28)
    at new Prompt (/Users/justynajanczyszyn/REPOS/mapbox/mbxcli/node_modules/@mapbox/cfn-config/node_modules/inquirer/lib/prompts/base.js:43:26)
    at new ListPrompt (/Users/justynajanczyszyn/REPOS/mapbox/mbxcli/node_modules/@mapbox/cfn-config/node_modules/inquirer/lib/prompts/list.js:18:5)
    at PromptUI.fetchAnswer (/Users/justynajanczyszyn/REPOS/mapbox/mbxcli/node_modules/@mapbox/cfn-config/node_modules/inquirer/lib/ui/prompt.js:85:25)
    at MergeMapSubscriber._tryNext (/Users/justynajanczyszyn/REPOS/mapbox/mbxcli/node_modules/rxjs/internal/operators/mergeMap.js:69:27)
    at MergeMapSubscriber._next (/Users/justynajanczyszyn/REPOS/mapbox/mbxcli/node_modules/rxjs/internal/operators/mergeMap.js:59:18)
    at MergeMapSubscriber.Subscriber.next (/Users/justynajanczyszyn/REPOS/mapbox/mbxcli/node_modules/rxjs/internal/Subscriber.js:67:18)

@mapbox/platform

jjanczyszyn avatar May 14 '19 19:05 jjanczyszyn

@jjanczyszyn I believe all AllowedValues need to be strings, even if the Type of the property is a Number.

jakepruitt avatar May 14 '19 19:05 jakepruitt

Ok, confirmed that strings in AllowedValues worked.

Still, then would be great if template validation would return invalid for this case and right now it returns valid.

Also, there's no clear error message - one only appears if you forcefully kill the update - otherwise it just hangs indefinitely.

jjanczyszyn avatar May 14 '19 21:05 jjanczyszyn