Azure / Azure/azure-webpubsub

Triggering webPubSubTrigger in local Azure Function, always lead to 401 error

Open
#227 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
147
Forks
96
Avg merge
19h 28m
Merged PRs (30d)
87

Description

Describe the bug
When using webPubSubTrigger in a Azure Function app, I am unable to ever get it to trigger when using an locale Azure Function

My function is simply this

function.json

```
{
"disabled": false,
"bindings": [
{
"type": "webPubSubTrigger",
"direction": "in",
"name": "connectionContext",
"hub": "notification",
"eventName": "connected",
"eventType": "system"
},
{
"type": "http",
"direction": "out",
"name": "res"
}
],
}
```

index.js

```
module.exports = async function (context, req, connectionContext) {
console.log("connected!! ", connectionContext);

context.res = {
body: "working!",
};
}
```
When working locally I can run the functions using core tools, and expose via ngrok, then add an event handler pointing at https://blahblah.ngrok.io/runtime/webhooks/webpubsub and it does not work!!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the function.json binding and index.js handler, then reproduce the local Azure Function through Azure Functions Core Tools and the ngrok URL configured as the event handler. Inspect where the 401 occurs at /runtime/webhooks/webpubsub; done means the connected event reaches the local function and logs connectionContext without a 401.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, javascript
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.