Skip to content

Commit ed71370

Browse files
authored
Update howto-local-debug-event-handler.md
1 parent 0ee7c2e commit ed71370

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

articles/azure-web-pubsub/howto-local-debug-event-handler.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: How to troubleshoot and debug Azure Web PubSub event handler locally
2+
title: How to troubleshoot and debug Azure Web PubSub event handler
33
description: Guidance about debugging event handler locally when developing with Azure Web PubSub service.
44
author: vicancy
55
ms.author: lianwei
@@ -8,10 +8,12 @@ ms.topic: how-to
88
ms.date: 12/20/2023
99
---
1010

11-
# How to troubleshoot and debug Azure Web PubSub event handler locally
11+
# How to troubleshoot and debug Azure Web PubSub event handler
1212

1313
When a WebSocket connection connects to Web PubSub service, the service formulates an HTTP POST request to the registered upstream and expects an HTTP response. We call the upstream as the **event handler** and the **event handler** is responsible to handle the incoming events following the [Web PubSub CloudEvents specification](./reference-cloud-events.md).
1414

15+
## Run the event handler endpoint locally
16+
1517
When the **event handler** runs locally, the local server isn't publicly accessible.
1618

1719
There are two ways to route the traffic to your localhost, one is to expose localhost to be accessible on the internet using tools such as [ngrok](https://ngrok.com), [localtunnel](https://github.com/localtunnel/localtunnel), or [TunnelRelay](https://github.com/OfficeDev/microsoft-teams-tunnelrelay). Another way, and also the recommended way is to use [awps-tunnel](./howto-web-pubsub-tunnel-tool.md) to tunnel the traffic from Web PubSub service through the tool to your local server.
@@ -30,6 +32,16 @@ The webview contains four tabs:
3032

3133
Follow [Develop with local tunnel tool](./howto-web-pubsub-tunnel-tool.md) to install and run the tunnel tool locally to develop your **event handler** server locally.
3234

35+
## Debug the event handler endpoint online
36+
37+
Sometimes you might have issue sending events to configured event handler upstream, one typical error type is related to abuse protection failure, for example, `AbuseProtectionResponseInvalidStatusCode`, `AbuseProtectionResponseMissingAllowedOrigin`, or `AbuseProtectionResponseFailed`. Such error is probably related to your upstream app server settings, for example, 403 status code might be related to your app server authentication configuration, 404 status code might caused by inconsistent event handler path configured. One way to troubleshoot such failure is to send an abuse protection request to your configured event handler URL to see if it works, for example, using `curl` command to send an abuse protection request to your event handler upstream `https://abc.web.com/eventhandler` is as below:
38+
39+
```bash
40+
curl https://abc.web.com/eventhandler -X OPTIONS -H "WebHook-Request-Origin: *" -H "ce-awpsversion: 1.0" --ssl-no-revoke -i
41+
```
42+
43+
The command should return 204.
44+
3345
## Next steps
3446

35-
[!INCLUDE [next step](includes/include-next-step.md)]
47+
[!INCLUDE [next step](includes/include-next-step.md)]

0 commit comments

Comments
 (0)