|
| 1 | +--- |
| 2 | +title: "Troubleshooting guide for Azure Web PubSub Service" |
| 3 | +description: Learn how to troubleshoot common issues for Web PubSub |
| 4 | +author: JialinXin |
| 5 | +ms.service: azure-web-pubsub |
| 6 | +ms.topic: how-to |
| 7 | +ms.date: 04/28/2023 |
| 8 | +ms.author: jixin |
| 9 | +ms.devlang: csharp |
| 10 | +--- |
| 11 | + |
| 12 | +# Troubleshooting guide for common issues |
| 13 | + |
| 14 | +This article provides troubleshooting guidance for some of the common issues that customers might encounter. Listed errors are available to check when you turn on [`live trace tool`](./howto-troubleshoot-resource-logs.md#capture-resource-logs-by-using-the-live-trace-tool) or collect from [Azure Monitor](./howto-troubleshoot-resource-logs.md#capture-resource-logs-with-azure-monitor). |
| 15 | + |
| 16 | + |
| 17 | +## 404 from HttpHandlerUnexpectedResponse |
| 18 | + |
| 19 | +### Possible errors |
| 20 | + |
| 21 | +`Sending message during operation hub:<your-hub>,event:connect,type:sys,category:connections,requestType:Connect got unexpected response with status code 404.` |
| 22 | + |
| 23 | +### Root cause |
| 24 | + |
| 25 | +This error indicates the event is registered in Web PubSub settings but fail to get a response from registered upstream URL. |
| 26 | + |
| 27 | +### Troubleshooting guide |
| 28 | + |
| 29 | +- Check your upstream server function or method whether it's good to work. |
| 30 | +- Check whether this event is intended to register. If not, remove it from the hub settings in Web PubSub side. |
| 31 | + |
| 32 | +## 500 from HttpHandlerUnexpectedResponse |
| 33 | + |
| 34 | +### Possible errors |
| 35 | + |
| 36 | +- `Sending message during operation handshake got unexpected response with status code 500. Detail: Get error from upstream: 'Request is denied as target server is invalid'` |
| 37 | +- `Sending message during operation hub:<your-hub>,event:connect,type:sys,category:connections,requestType:Connect got unexpected response with status code 500.` |
| 38 | + |
| 39 | +### Root cause |
| 40 | + |
| 41 | +This error indicates event request get a `500` response from registered upstream. |
| 42 | + |
| 43 | +### Troubleshooting guide |
| 44 | + |
| 45 | +- Check upstream side logs to investigate if there's some errors during handling the reported event. |
| 46 | + |
| 47 | +## AbuseProtectionResponseMissingAllowedOrigin |
| 48 | + |
| 49 | +### Possible errors |
| 50 | + |
| 51 | +- `Abuse protection for 'https://<upstream-host>/<upstream-path>' missing allowed origins: .` |
| 52 | + |
| 53 | +### Root cause |
| 54 | + |
| 55 | +Web PubSub follows the [CloudEvents Abuse Protection](https://github.com/cloudevents/spec/blob/v1.0/http-webhook.md#4-abuse-protection) to validate the upstream webhook. Every registered upstream webhook URL will be validated. The `WebHook-Request-Origin` request header is set to the service domain name `<web-pubsub-name>.webpubsub.azure.com`, and it expects the response to have a header `WebHook-Allowed-Origin` to contain this domain name or `*`. |
| 56 | + |
| 57 | +### Troubleshooting guide |
| 58 | + |
| 59 | +Review the upstream side code to ensure when upstream receives the `OPTIONS` preflight request from Web PubSub service, it's correctly handled following the rule that contains the expected header `WebHook-Allowed-Origin` and value. |
| 60 | + |
| 61 | +Besides, you can update to convenience server SDK, which automatically handles `Abuse Protection` for you. |
| 62 | + |
| 63 | +- [@web-pubsub-express for JavaScript ](https://www.npmjs.com/package/@azure/web-pubsub-express) |
| 64 | +- [Microsoft.Azure.WebPubSub.AspNetCore for C#](https://www.nuget.org/packages/Microsoft.Azure.WebPubSub.AspNetCore) |
| 65 | + |
| 66 | +## 401 Unauthorized from AbuseProtectionResponseInvalidStatusCode |
| 67 | + |
| 68 | +### Possible errors |
| 69 | + |
| 70 | +- `Abuse protection for 'https://<upstream-host>/<upstream-path>' failed: 401.` |
| 71 | + |
| 72 | +### Root cause |
| 73 | + |
| 74 | +This error indicates the `Abuse Protection` request get a `401` response from the registered upstream URL. For more information, see [`Abuse Protection`](./howto-develop-eventhandler.md#upstream-and-validation). |
| 75 | + |
| 76 | +### Troubleshooting guide |
| 77 | + |
| 78 | +- Check if there's any authentication enabled in upstream side, for example, the `App Keys` for a `WebPubSubTrigger` Azure Function is set correctly, see [example](./quickstart-serverless.md?#configure-the-web-pubsub-service-event-handler). |
| 79 | +- Check upstream side logs to investigate how is the `Abuse Protection` request processed. |
| 80 | + |
| 81 | +## Client connection drops |
| 82 | + |
| 83 | +When the client is connected to Azure Web PubSub, the persistent connection between the client and Azure Web PubSub can sometimes drop for different reasons. This section describes several possibilities causing such connection drop and provides some guidance on how to identify the root cause. |
| 84 | + |
| 85 | +You can check the metric `Connection Close Count` from Azure portal. |
| 86 | + |
| 87 | +### Possible reasons and root cause |
| 88 | + |
| 89 | +| Reason | Root cause | |
| 90 | +|--|--| |
| 91 | +| Normal | Close by clients | |
| 92 | +| ClosedByAppServer | Close by server triggered Rest API call like [`CloseConnection`](/rest/api/webpubsub/dataplane/web-pub-sub/close-connection?tabs=HTTP) | |
| 93 | +| ServiceReload | Close by service due to regular maintenance or backend auto scales | |
| 94 | +| PingTimeout | Close by service due to client status unhealthy that service doesn't receive any regular pings | |
| 95 | +| SlowClient | Close by service due to clients are not able to receive buffered messages fast enough | |
| 96 | + |
| 97 | +### Troubleshooting guide |
| 98 | + |
| 99 | +`PingTimeout` and `SlowClient` indicates that you have some clients not able to afford current traffic load. It's suggested to control the message sending speed and investigate [client traces](./howto-troubleshoot-network-trace.md) if client side performance can be improved. |
| 100 | + |
| 101 | +## ConnectionCountLimitReached |
| 102 | + |
| 103 | +Web PubSub different tiers have a hard limit on concurrent connection. This error indicates your traffic is beyond the supported connection count. For more information about pricing, see [Web PubSub pricing](https://azure.microsoft.com/pricing/details/web-pubsub/). |
| 104 | + |
| 105 | +### Solution |
| 106 | + |
| 107 | +Scale up to a paid tier(Standard or Premium) to have at least 1000 connections or scale out to more units that support more connections. |
| 108 | + |
0 commit comments