Botframework-composer: Published Bot won't work via Direct Channel. Bot responds "Value cannot be null. (Parameter 'key')"

Created on 2 Jul 2020  路  7Comments  路  Source: microsoft/BotFramework-Composer

A bot created and published by the Bot Framework Composer will work fine with the default Web Chat channel.
When adding the Direct Line channel and then performing requests against the API REST endpoint, the Bot will give the initial greeting and then onward responds only with "Value cannot be null. (Parameter 'key')".

Version

1.01

Browser

  • [X] Electron distribution
  • [ ] Chrome
  • [ ] Safari
  • [ ] Firefox
  • [ ] Edge

OS

  • [ ] macOS
  • [X] Windows
  • [ ] Ubuntu

To Reproduce

Steps to reproduce the behavior:

  1. download the Bot Composer project from this tutorial
  2. remove the two HTTP requests (they are not needed for testing this issue)
  3. deploy it accordingly and add the Direct Line channel
  4. do a conversation via Postman or other means to talk with Direct Line channel

Expected behavior

The bot should give proper response and not the error message.

Screenshots

This is how the Resources on azure look like after deployment:
Screenshot 2020-07-02 at 01 54 47

Could it be that an App setting is missing on the App Service?
Capture

Additional context

This is a continuation from this bug report: https://github.com/microsoft/BotFramework-Composer/issues/2240

SDK Bug

Most helpful comment

Hey @rubit0 I was facing the exactly same issue for a couple of days and luckly I could find out why this morning.

In my case what fixed was adding the "locale" field in the json request body when creating an activity. Here is how my POST request looks like:

POST https://directline.botframework.com/v3/directline/conversations/{conversationId}/activities

{
"from": {
"id": "customId",
"name": "customName",
"role": "user"
},
"locale": "pt-BR",
"recipient": {
"id": "bot",
"name": "Bot",
"role": "bot"
},
"text": "some text",
"textFormat": "plain",
"type": "message"
}

Hope this helps you somehow

All 7 comments

@rubit0 , I have dowloaded your bot and tested it. It works fine in my side, the only change I did is to remove the httpsteps to the azure functions, because I don't have a azure function example. Could the issue be caused by the http request to azure functions? could you share more details on that? do you use any key to access the azure function urls?

image

image

Hey @rubit0 I was facing the exactly same issue for a couple of days and luckly I could find out why this morning.

In my case what fixed was adding the "locale" field in the json request body when creating an activity. Here is how my POST request looks like:

POST https://directline.botframework.com/v3/directline/conversations/{conversationId}/activities

{
"from": {
"id": "customId",
"name": "customName",
"role": "user"
},
"locale": "pt-BR",
"recipient": {
"id": "bot",
"name": "Bot",
"role": "bot"
},
"text": "some text",
"textFormat": "plain",
"type": "message"
}

Hope this helps you somehow

@viivalerio Oh wow now it works! Thank you!

This is how the request body must look like when posting a new acticity:

{
"locale": "en-EN",
"type": "message",
"from": {
"id": "user1"
},
"text": "Hello bot."
}

@luhan2017 @@DDEfromOR I did submit the problem and solution to the documentation page: https://github.com/MicrosoftDocs/bot-docs/issues/1806

Big thanks again to @viivalerio in providing the fix!

@Danieladu @boydc2014 Do you have more comments for this issue ? sounds like LG language policy issue.

https://github.com/microsoft/botbuilder-dotnet/issues/4219 sdk fixed the issues . composer will adopt latest sdk fix.

composer has updated the sdk version to 4.10.0, so close this.

Was this page helpful?
0 / 5 - 0 ratings