[WebChat] Getting 503 (Service Unavailable) and 502 (Bad Gateway) errors?
Bot Info
- App ID: 62a3f1ae-f10a-43f4-ac70-d2c22b3f69a5
- SDK Platform: .NET
- SDK Version: 3.8.5
- Active Channels: WebChat
- Deployment Environment: Azure App Service
Issue Description
Webchat responses/requests seem to be significantly slower than before. Started experiencing this a couple hours ago. No code change, this just started happening all of a sudden. Every 2nd or 3rd request causes 503/502 errors. This causes the webchat responses/request to be extremely delayed or not work at all.
Reproduction Steps
- Start conversation (say hi)
- Request expected option (ex: printer)
- check console in dev tools in browser to check for error.
Expected Behavior
WebChat should respond with expected response (a link) within 3-5 seconds.
Actual Results
Will occasionally work as expected, most of the time it says the request timed out, or "couldnt send, retry", but it actually does send, just takes 20-30 seconds. So in summary, sometimes the requests go through but take much longer than expected. And sometimes they don't make it through at all and throw 503's and 502's.
Let me know if you require further information. Thanks.
+1 We are experiencing the same issue basically. It usually only starts to happen for us when the app is under 'load' i.e. 5 or more concurrent users. Which I would not really call much load. This is via our DirectLine integration.
Here are some logs from AppInsights:
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond XX.XXX.XX.XXX:443
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Rest.RetryDelegatingHandler.<>c__DisplayClass11_0.<
E.g. calls:
https://state.botframework.com/v3/botstate/directline/conversations/CUgSMYbMPqJFakLhjfFFVe https://state.botframework.com/v3/botstate/directline/conversations/HGUEVFqYOM0JkVuxd4cPyM https://state.botframework.com/v3/botstate/directline/conversations/4ifUN0DCpUc8u71Ml826Bz
Dependency duration:
4:17:46 PM | Dependency | 42.04 sec@RD0003FF559E4E /v3/botstate/directline/conversations/4ifUN0DCpUc8u71Ml826Bz
Time 4:17:51 PM Duration 21.02 sec Outgoing Command /v3/botstate/directline/conversations/HGUEVFqYOM0JkVuxd4cPyM https://state.botframework.com/v3/botstate/directline/conversations/HGUEVFqYOM0JkVuxd4cPyM
Time 4:18:10 PM Duration 42.04 sec Outgoing Command /v3/botstate/directline/conversations/2nHCblRjz4l83uIKPRgw7T https://state.botframework.com/v3/botstate/directline/conversations/2nHCblRjz4l83uIKPRgw7T
Have you implemented a custom state service or are you both using the default @ThisIsColinB @JPThorne. Also are you load testing directline or are you following this guide
@JasonSowers thanks yep that was the case as identified on a separate issue as well. We were still using the default state client. Only saw that blog post from you guys recently.
Worth mentioning, @JasonSowers to be fair the 'load' was only 5 concurrent users over a period of 2 minutes. Hardly what I'd call real load.
503 (Service Unavailable) issue occurs on WebChat as well as DirectLine. Often (once in a 5 to 6 messages) there is a delay receiving message from BotFramework to the backend
Bot Info
- SDK Platform: Node.js
- SDK Version: 3.11.0
- Active Channels: Direct Line, WebChat
- Deployment Environment: AWS
Issue Description
/v3/conversations/88YzQf6Cdk7G2Uv6R2omhb
The delay from Botframework is upto 8 seconds.

+1, getting this on webchat also. No load, one user, but bot was left idle. Sending a message to bot stops the errors occurring for approx 3 minutes.
Only happening since upgrading from botbuilder 3.11.0 to 3.13.1
@stoconnor Issue resolved when custom storage for state data was implemented. I don't know how these are connected but that resolved the issue for me
@kamidipreetham thanks, I moved to CosmosDB for bot storage. Issue looks to be resolved for me also
+1 I also have this issue. My applicatie is succesfully deployed en I created a Web App Bot. The default messaging endpoint works fine but when I changed it to my own messaging endpoint of mijn applicatie. something likes this: https://Your_Application_Name.azurewebsites.net/api/messages, then it didnt work any more. It gave also a 505 bad gateway error. Do I need some dependency injection in my code? I'm using bot framework v3 version Can someone help me?
Hi @pancongying
This is a closed issue, and this repository is only taking DCRs. If you are still struggling with this issue, please ask a question on StackOverlow. If you believe this is a bug in the SDK, please direct the issue to the V3 repository: https://github.com/Microsoft/BotBuilder-V3/issues/new/choose Also, please provide more information. Such as the actual endpoint you are trying to use along with your bot's handle and Microsoft App Id.