microsoft / microsoft/BotFramework-WebChat

POST activity HTTP502 fails silently

Open
#5,424 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bot Services bug customer-reported
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?

NPM

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

Hello Webchat team 👋
We experienced an issue that failed silently on the webchat frontend.

We have a lambda that directline calls when someone sends a message (POST
https://directline.botframework.com/v3/directline/conversations/<convId>/activities). We had an outage recently and the lambda was not responding.

The directline POST call was returning an HTTP 502.
In that case (in fact any error >= 500), there is no error that is displayed on screen.
I did a code exploration about this behavior (see What actually happened? section in this ticket)

Do you see any errors in console log?
No error in the console.
How to reproduce the issue?

That is a little tricky, we don't have any environment to reproduce it.
Our case was that the lambda that directline calls wasn't answering. But what is important is that the POST activity returns an HTTP 502.

What do you expect?

An error on the message that didn't gone through, with the retry button.

What actually happened?

The error was silent.

Here is my code investigation

In directline repo

During the postActivity function call, there is

  1. an ajax call (code link)
  2. on error (code link), there are 3 cases
    a. 403 --> expired token
    b. >400 <500 --> throw an error through the observable (code link)
    c. status >= 500 --> resolve the value retry via the observable (code link)
In webchat repo

When sending an activity, there is a race between the postActivity observable + message echo (via the websocket I guess), and a 20sec default timeout (code link).

  • postActivity Observable is mapped to a Promise (code link)
  • message echo from WebSocket I assume (code link)

In our case, the postActivity is resolved with "retry", and the mapped Promise is resolved, hiding the error.
No error is displayed on screen, but no response is coming neither, we have a bad user experience, we are waiting for an answer that will never come.

Do you have any screenshots or recordings to repro the issue?
Image

On the screenshot, we can see the POST activity that ended up with an HTTP 502, but we don't have any error under the message with the retry button.

Adaptive Card JSON

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/core/src/sagas/postActivitySaga.ts, especially the postActivity promise and timeout handling described in the issue, then compare it with DirectLine's retry result for HTTP 500+ responses. Confirm the behavior using an HTTP 502 response; done means the failed activity shows an error and retry button instead of remaining silent.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.