x-team / the-vault

The Vault Coin counter
MIT License
3 stars 2 forks source link

Can't use /drawcoin for authenticated users #54

Closed AngeloR closed 6 years ago

AngeloR commented 6 years ago

There is currently a bug with /drawcoin that results in nothing being returned for admin users. Non admin users still receive the "invalid permissions" error. Looking through the logs I've found this error:

2018-06-06T12:30:20.848Z 60936805-6985-11e8-97a4-853c1ecc02aa Unhandled Rejection at: Promise Promise {
<rejected> TypeError: Cannot read property 'length' of null
at extractMentionedUsersAndCoins (/var/task/build/utils/extractMentionedUsers.js:46:30)
at SpendCoinsCommand._callee$ (/var/task/build/commands/spendCoins.js:47:26)
at tryCatch (/var/task/node_modules/regenerator-runtime/runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/var/task/node_modules/regenerator-runtime/runtime.js:299:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/var/task/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/var/task/build/commands/spendCoins.js:11:191)
at /var/task/build/commands/spendCoins.js:11:437
at Slack.<anonymous> (/var/task/build/commands/spendCoins.js:11:99)
at Slack.<anonymous> (/var/task/build/commands/spendCoins.js:128:23)
at emitThree (events.js:116:13) } reason: TypeError: Cannot read property 'length' of null
at extractMentionedUsersAndCoins (/var/task/build/utils/extractMentionedUsers.js:46:30)
at SpendCoinsCommand._callee$ (/var/task/build/commands/spendCoins.js:47:26)
at tryCatch (/var/task/node_modules/regenerator-runtime/runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/var/task/node_modules/regenerator-runtime/runtime.js:299:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/var/task/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/var/task/build/commands/spendCoins.js:11:191)
at /var/task/build/commands/spendCoins.js:11:437
at Slack.<anonymous> (/var/task/build/commands/spendCoins.js:11:99)
at Slack.<anonymous> (/var/task/build/commands/spendCoins.js:128:23)
at emitThree (events.js:116:13)
AngeloR commented 6 years ago

Further investigations look like the cause of this is

1) bad error handling 2) bad documentation on how to use the commands

I've updated the slackbot integration for /grantcoin and /drawcoin so that users can see the correct order of arguments.