0

I have an Azure SignalR service setup with upstream. Negotiate is working, but I am getting a 404 error when trying to use connection.invoke('events', { ... });

In the SignalR event log, I am getting (irrelevant bits omitted):

{ 
  "properties": {
    "message": "Sending message during operation {hub}=map,{event}=events,{category}=messages got unexpected response with status code 404. Detail: ",
    "type":"MessagingLogs",
    "collection":"Serverless"
  }, 
  "operationName": "HttpHandlerUnexpectedResponse", 
  "callerIpAddress": "null" 
}

What might be causing the 404?

There is a Azure Function app setup with an events function with the following bindings:

{
  "disabled": false,
  "bindings": [
    {
      "authLevel": "anonymous",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": [
        "post"
      ]
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    },
    {
      "type": "signalR",
      "name": "$return",
      "hubName": "map",
      "direction": "out"
    }
  ]
}

I believe the function app is getting setup correctly. I have the following setup as my upstream (with info replaced in the actual call: <function_app_server>/runtime/webhooks/signalr?code=<signalr_extension_key>

Orion Adrian
  • 19,053
  • 13
  • 51
  • 67

1 Answers1

0

Apparently the bindings have changed for Azure when using Upstream. The following bindings worked:

{
    "bindings": [
        {
            "type": "signalRTrigger",
            "name": "invocation",
            "hubName": "map",
            "category": "messages",
            "event": "events",
            "parameterNames": [
                "message"
            ],
            "direction": "in",
        },
        {
            "type": "signalR",
            "name": "signalRMessages",
            "hubName": "map",
            "connectionStringSetting": "AzureSignalRConnectionString",
            "direction": "out"
        }
    ]
}
module.exports = function (context, invocation) {
  context.bindings.signalRMessages = [{
    "target": "newMessage", // name of the client method to invoke
    "arguments": [
      context.bindingData.message // arguments to pass to client method
    ]
  }];
  context.done();
};
Orion Adrian
  • 19,053
  • 13
  • 51
  • 67