BotBuilder-Samples: 46.teams-auth UnhandledPromiseRejectionWarning

Sample information

  1. Sample type: sample
  2. Sample language: nodejs
  3. Sample name: 46.teams-auth

Environment

nodejs 10.16.3

Describe the bug

Intermittently when using the sign in behaviour an error is thrown.

(node:52355) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toString' of undefined at BotFrameworkAdapter.processActivity (/Users/peterphelan/Workspace/BotBuilder-Samples/samples/javascript_nodejs/46.teams-auth/node_modules/botbuilder/lib/botFrameworkAdapter.js:510:91) at process._tickCallback (internal/process/next_tick.js:68:7) (node:52355) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:52355) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

To Reproduce

Steps to reproduce the behavior:

  1. Use the sample bot as provided in the repository
  2. Login & Logout until error occurs (This is usually within a few tries)

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Running the npm start locally with a .env file setup we exposed the restify server using ngrok and setup the messaging endpoint in the bot channel registration settings to be the ngrok URL.

I added a log ling here: https://github.com/microsoft/BotBuilder-Samples/blob/master/samples/javascript_nodejs/46.teams-auth/dialogs/mainDialog.js#L55 which is ‘Running the login step’

I also added a log line here: https://github.com/microsoft/BotBuilder-Samples/blob/master/samples/javascript_nodejs/46.teams-auth/dialogs/mainDialog.js#L44 which is ‘Result of continue dialog’,results’

In the happy path my log output is: Running dialog with Message Activity. Result of continue dialog { status: 'empty' } Running dialog with Invoke Activity. Running the login step Result of continue dialog { status: 'waiting' } Running dialog with Message Activity. Result of continue dialog { status: 'complete', result: undefined } This was completed with three messages:

  1. Hi
  2. Use the signin prompt and authenticate
  3. Logout

In the bad path my log output is: Running dialog with Message Activity. Result of continue dialog { status: 'empty' } Running dialog with Invoke Activity. Result of continue dialog { status: 'waiting' } (node:52355) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toString' of undefined at BotFrameworkAdapter.processActivity (/Users/peterphelan/Workspace/BotBuilder-Samples/samples/javascript_nodejs/46.teams-auth/node_modules/botbuilder/lib/botFrameworkAdapter.js:510:91) at process._tickCallback (internal/process/next_tick.js:68:7) (node:52355) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:52355) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This was completed with two messages:

  1. Hi
  2. Use the signin prompt and authenticate

The notable difference here is the lack of ‘Running the login step’

After using the signin prompt the failure occurs.

[bug]

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 24 (16 by maintainers)

Most upvoted comments

Hello,

I have made a fix to the Bot Framework’s token service that I expect will make these intermittent “cannot sign-in” errors stop. Those changes should go live between 11/6 and 11/15.

Thank you for reporting, for all of the repros, and for the investigation!

Jeff

Hi!

I recreated the issue multiple times again in the last 20 minutes.

The same appId as before, and I can of course recreate again after Thursday.

Im running on OSx and couldnt get Fiddler going even with mono and your gone beyond my own knowledge there to try help further.

If I can do anything else let me know