Triggering webPubSubTrigger in local Azure Function, always lead to 401 error
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!!
Any traffic observed from the ngrok dashboard? Is it that the event handler is not invoked at all (ngrok has no incoming traffic) or the function returns 401 (ngrok logs 401 response)?
the functions returns 401. ngrok receives 401 response
@svgrun, have you configured the WebPubSubConnectionString which is used for output binding as well as for Abuse Protection validations. This used to be required until 1.0.0-beta.3 version. From 1.0.0-beta.4 version which is releasing, it allows empty settings.