Azure / azure-signalr

Azure SignalR Service SDK for .NET
https://aka.ms/signalr-service
MIT License
425 stars 100 forks source link

Improve diagnostic information and steps for upstream 404 failures. #1189

Open oadrian2 opened 3 years ago

oadrian2 commented 3 years ago

I have setup an upstream connection targeting my JavaScript Azure Function app. The problem is between the library and the Azure SignalR logs, all it's telling me is that I have a 404, but I'm not sure what to do next. The system connects and functions via direct posts to function endpoints, but the connection.invoke(<messageName>, ...args) doesn't. I am currently at a loss and the libraries nor the documentation seem to show what to do in this particular case in terms of next steps.

The function name matches the invoke call. The function works when hit directly via post. The endpoint is using the signalr_extension key. When given the wrong key, I get a 401, instead. The SignalR logs show that a 404 happened.

If there are common missteps, it would be nice if the error messages would suggest fixes. E.g.: Invocation failed, status code 404 isn't very helpful compared to something like:

Warning: Each child in a list should have a unique "key" prop.
Check the render method of `Supply`. See https://reactjs.org/link/warning-keys for more information.
oadrian2 commented 3 years ago

I eventually figured out the issue, but there are currently two different supported syntaxes for SignalR. One uses the new trigger syntax for SignalR with upstream configuration. The other still supports SignalR + Azure Functions, but uses a different syntax. And since both are currently supported, neither indicates that it is out-of-date.

One particular help might be if no endpoint actions were detected using upstream, giving a warning. Understandably that might not be advisable if discovery would open up security vulnerabilities. Another possibility might be a migration page showing how to migrate from pre-upstream HTTP triggers to SignalR triggers.

Ultimately, only one !Note box shows how to handle upstream. And searching via Google (or other search engine) is just as likely to pull up the older pre-upstream syntax.