Describe the bug
While going through the storage setup for dynamo, the cli will seemingly skip questions. It was defaulting to "true" for each "Would you like to add another column" and on a second try it defaulted to "false" after first column and went directly to primary key.
To Reproduce
Steps to reproduce the behavior:
1) cli: amplify storage add
2) nosql
3) Enter resource label
4) enter table name
5) name first column "name" and set type as String
6) yes to add new column
7) name second column "test" and set type as List
8) at this point mine will skip the next "would you like to add another column" and default to true and ask for the name of the new column
Expected behavior
Will be prompted for each column setup
Screenshots

Desktop (please complete the following information):
Additional context
cli version: 0.1.34
Same issue with cli version 0.1.35 on macOS.
@cityzen what version of node do you have installed?
@yuth I have issue with node 10.13.0
@yuth I am also experiencing the same issue with both [email protected] and [email protected] on node 8.11.0.
@yuth I'm on node 10.11.0
The issue is here:
I suspect there is an issue with context.prompt.confirm, but I'm having trouble finding where that is defined.
@zjullion context.prompt.confirm is declared in gluegun.
The funny things is I can reproduce this issue and one of my co-worker has identical setup and everything work on in his machine.
For some reason await doesn't wait for the function call to return. Its using the value from the previous call after first invocation.
From our testing, it doesn't always seem to return the value from the previous call - it will sometimes (seemingly randomly) return another value.
A simple work to work around this is the following:
const continueQuestion = {
type: 'confirm',
name: 'continue',
message: 'Wanna add another column?',
};
const continueAnswer = await inquirer.prompt([continueQuestion]);
continueAttributeQuestion = continueAnswer.continue;
It's a little strange to me that amplify-cli hooks into gluegun's use of enquirer for some prompts, while mostly using inquirer. Should all the calls to context.prompt.confirm maybe be refactored to inquirer calls?
It's a little strange to me that amplify-cli hooks into gluegun's use of enquirer for some prompts, while mostly using inquirer. Should all the calls to
context.prompt.confirmmaybe be refactored to inquirer calls?
Using glueguns confirm makes the code lot more readable. But yes we should move all our interaction code to use inquirer which is a little more involved as we have this in bunch of places
@yuth I can open a PR for this, if you like. It should be ready to go sometime tomorrow at the latest.
I already have a fix. PR coming right up in a bit
You've updated the prompts in /packages/amplify-category-storage/provider-utils/awscloudformation/service-walkthroughs/dynamoDb-walkthrough.js, but gluegun's context.prompt.confirm is also used in a number of other files - is it worth updating those as well?
The fix has been released in 0.1.36
Most helpful comment
The fix has been released in
0.1.36