AnomalyInnovations/aws-api-gateway-cli-test

Expected params.AuthParameters['USERNAME'] to be a string

jeremyhodges opened this issue · 5 comments

My AWS user pool is setup to use only phone numbers as the username. When I try to make an API call with this test cli I get the following message:

Authenticating with User Pool
Expected params.AuthParameters['USERNAME'] to be a string

I tried wrapping the username parameter in both single and double quotes. Same result.

npx aws-api-gateway-cli-test \
--username='15555555555' \
--password='Passw0rd!' \
...

@jeremyhodges I haven't tested it with phone numbers but we aren't doing anything specific for string based user names. We simply pass it to the Cognito JS SDK. Can you confirm that you are able to use the Cognito SDK to authenticate in your app?

sjl2 commented

Looks like yargs will take the input here for username, but the problem for phone numbers is that they're probably getting converted to numbers.

Every argument that looks like a number (!isNaN(Number(arg))) is converted to one. This way you can just net.createConnection(argv.port) and you can add numbers out of argv with + without having that mean concatenation, which is super frustrating.
Reference

PoC

node
> !isNaN(Number('+013333333333'))
true

Looks like the username argument will need to be coerced to a string.

@sjl2 Good catch! Thanks for looking into it. I'll test it out and update it.

man this is irritating indeed lol

Fixed this in 1.3.1.