Skip to content

Commit efdc1b5

Browse files
authored
Merge pull request #274649 from vicancy/patch-14
Update howto-local-debug-event-handler.md
2 parents d1e4813 + c6beab6 commit efdc1b5

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
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 issues sending events to a configured event handler upstream. One typical error type is related to abuse protection failure, for example, `AbuseProtectionResponseInvalidStatusCode`, `AbuseProtectionResponseMissingAllowedOrigin`, or `AbuseProtectionResponseFailed`. Such an 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 be caused by inconsistent event handler path configuration. 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 configured event handler URL `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)]

articles/azure-web-pubsub/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
href: howto-move-across-regions.md
129129
- name: Troubleshoot
130130
items:
131-
- name: Debug event handlers locally
131+
- name: Debug event handlers
132132
href: howto-local-debug-event-handler.md
133133
- name: Collect network trace
134134
href: howto-troubleshoot-network-trace.md

0 commit comments

Comments
 (0)