microsoft / microsoft/BotFramework-WebChat
Handling errors when sending messages to the bot
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1.8k
- Forks
- 1.6k
- Avg merge
- 22h 58m
- Merged PRs (30d)
- 2
Description
Is it an issue related to Adaptive Cards?
No
Is this an accessibility issue?
No
What version of Web Chat are you using?
Latest production
Which distribution are you using Web Chat from?
Bundle (webchat.js)
Which hosting environment does this issue primarily affect?
Web apps
Which browsers and platforms do the issue happened?
Browser: Chrome (latest)
Which area does this issue affect?
Others or unrelated
Which theme pack does this issue affect?
I did not test it on other theme packs
What is the public URL for the website?
No response
Please describe the bug
When the bot fails to respond and the Direct Line POST /v3/directline/conversations/{id}/activities returns an error (e.g., 502 Bad Gateway), Web Chat does not render any error message or system notification. I also can't find a way to register a listener for that error to display any custom messages outside of the chat or perform any actions.
The user sees no feedback in the transcript; only the browser console logs the 5xx. This creates the impression that the bot ignored the message.
Is there any way to register a listener and display the message sending error? Since none of the listeners used are called when this error occurs.
Do you see any errors in console log?
botframework-webchat.js:2 POST https://directline.botframework.com/v3/directline/conversations/xxxxxxxxxxx/activities 502 (Bad Gateway)
o @ botframework-webchat.js:2
t.send @ botframework-webchat.js:2
t @ botframework-webchat.js:2
t._subscribe @ botframework-webchat.js:2
e._trySubscribe @ botframework-webchat.js:2
e.subscribe @ botframework-webchat.js:2
e.call @ botframework-webchat.js:2
e.subscribe @ botframework-webchat.js:2
e.call @ botframework-webchat.js:2
e.subscribe @ botframework-webchat.js:2
e.call @ botframework-webchat.js:2
e.subscribe @ botframework-webchat.js:2
t.subscribeToResult @ botframework-webchat.js:2
t._innerSub @ botframework-webchat.js:2
t._tryNext @ botframework-webchat.js:2
t._next @ botframework-webchat.js:2
t.next @ botframework-webchat.js:2
t._next @ botframework-webchat.js:2
t.next @ botframework-webchat.js:2
t.notifyNext @ botframework-webchat.js:2
t._next @ botframework-webchat.js:2
t.next @ botframework-webchat.js:2
t.dispatch @ botframework-webchat.js:2
t._execute @ botframework-webchat.js:2
t.execute @ botframework-webchat.js:2
t.flush @ botframework-webchat.js:2
setInterval
t.requestAsyncId @ botframework-webchat.js:2
t.schedule @ botframework-webchat.js:2
e.schedule @ botframework-webchat.js:2
t._subscribe @ botframework-webchat.js:2
e._trySubscribe @ botframework-webchat.js:2
e.subscribe @ botframework-webchat.js:2
t.subscribeToResult @ botframework-webchat.js:2
t._innerSub @ botframework-webchat.js:2
t._tryNext @ botframework-webchat.js:2
t._next @ botframework-webchat.js:2
t.next @ botframework-webchat.js:2
t._next @ botframework-webchat.js:2
t.next @ botframework-webchat.js:2
t.notifyNext @ botframework-webchat.js:2
t._next @ botframework-webchat.js:2
t.next @ botframework-webchat.js:2
t.dispatch @ botframework-webchat.js:2
t._execute @ botframework-webchat.js:2
t.execute @ botframework-webchat.js:2
t.flush @ botframework-webchat.js:2
setInterval
....
How to reproduce the issue?
-
Render Web Chat with Direct Line (minimal sample below).
-
Start a normal conversation with the bot.
-
After the bot's first successful response, cause the bot endpoint to fail (stop the bot or return HTTP 5xx).
-
Send another message.
What do you expect?
A way to register a listener and display the message sending error
What actually happened?
There is no visible error or way to listen for that message sending error when you get an error code from the API
Do you have any screenshots or recordings to repro the issue?
Adaptive Card JSON
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with the bundled webchat.js and a Direct Line POST /v3/directline/conversations/{id}/activities that returns HTTP 5xx. Trace how the failed send is surfaced beyond the browser console, then verify that the transcript shows feedback or exposes a listener for the sending error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100