[Node.js SDK] Session.endConversation() causes [400] Bad Request and no username
Bot Info
- SDK Platform: Node.js
- SDK Version: 3.15.0
- Active Channels: Skype
- Deployment Environment: Local via ngrok
Issue Description
An endConversation causes a '400' POST and after this the session.message.user.name is undefined.
Error: POST to 'https://smba.trafficmanager.net/apis/v3/conversations/29%3A12fMgeiJDkMJmp5SXwnHt7tJf7sl3sst22-FBErf-7mY/activities' failed: [400] Bad Request
Code Example
// in a middleware function
return {
botbuilder: (session, next) => {
if (session.message.text) {
const match = /test/i.exec(session.message.text);
if (!match) {
return next();
}
return session.endConversation(message);
}
return next();
}
};
Reproduction Steps
- Connect to bot using Skype via ngrok.
- type 'test'. Notice a breakpoint in the middeware function will have a populated
session.message.user.name. - The bot will emit an error, see below.
- The next time a message is recieved in the middleware
session.message.user.nameis undefined.
Expected Behavior
No error and the user address
Actual Results
Error: POST to 'https://smba.trafficmanager.net/apis/v3/conversations/29%3A12fMgeiJDkMJmp5SXwnHt7tJf7sl3sst22-FBErf-7mY/activities' failed: [400] Bad Request
Here is the options var for ChatConnector.prototype.postMessage right before the error:
{
"method": "POST",
"url": "https://smba.trafficmanager.net/apis/v3/conversations/29%3A12fMgeiJDkMJmp5SXwnHt7tJf7sl3sst22-FBErf-7mY/activities",
"body": {
"type": "endOfConversation",
"code": "completedSuccessfully",
"localTimestamp": "2018-06-08T09:46:49.900Z",
"from": {
"id": "28:1c62f3fd-9eed-45e4-b9dd-c6c32cd0600e",
"name": "<Some Name>"
},
"recipient": {
"id": "29:12fMgeiJDkMJmp5SXwnHt7tJf7sl3sst22-FBErf-7mY"
}
},
"json": true
}
Hi @SeanSobey,
Please review the docs listed here as they should help in understanding what is happening.
In short, because the conversation is ended, per the text match in the middleware, there is nothing to be reported back when "The next time a message is received". The dialog stack has been cleared at this point and a 400 error is returned.
My suggestion is to build the .endConversation into the dialog flow as demonstrated in the docs. I'm closing this as I believe this solves your problem. Please reopen if you have additional related questions.
Steve.
Hi @stevkan, thanks for your reply.
My example was based off the Middleware.dialogVersion included in the SDK which also results in a 400 error:
bot.use(Middleware.dialogVersion({
version: 0.0,
resetCommand: /^reset$/i
}))
Error: POST to 'https://smba.trafficmanager.net/apis/v3/conversations/29%3A12fMgeiJDkMJmp5SXwnHt7tJf7sl3sst22-FBErf-7mY/activities' failed: [400] Bad Request
Note this only happens in Skype not via the Emulator, Slack or Messenger. This still appears to be a bug?
Hi @SeanSobey, I just saw you had responded. Let me take another look and will get back to you.
@stevkan this still appears to be an active bug, has anyone been able to confirm?
Hi @SeanSobey,
Yes, I was able to confirm your results. I will mark this as a bug for further consideration.
Thanks, Steve.
Thanks Steve
yeah we're experiencing the same issue
wonder if this is related to
https://github.com/Microsoft/BotBuilder/issues/3576
Thank you for opening an issue against the Bot Framework SDK v3. As part of the Bot Framework v4 release, we’ve moved all v3 work to a new repo located at https://github.com/microsoft/botbuilder-v3. We will continue to support and offer maintenance updates to v3 via this new repo.
From now on, https://github.com/microsoft/botbuilder repo will be used as hub, with pointers to all the different SDK languages, tools and samples repos.
As part of this restructuring, we are closing all tickets in this repo.
For defects or feature requests, please create a new issue in the new Bot Framework v3 repo found here: https://github.com/microsoft/botbuilder-v3/issues
For Azure Bot Service Channel specific defects or feature requests (e.g. Facebook, Twilio, Teams, Slack, etc.), please create a new issue in the new Bot Framework Channel repo found here: https://github.com/microsoft/botframework-services/issues
For product behavior, how-to, or general understanding questions, please use Stackoverflow. https://stackoverflow.com/search?q=bot+framework
Thank you.
The Bot Framework Team