Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error messaging for 404s #5350

Open
analogrelay opened this issue Oct 10, 2018 · 14 comments
Open

Improve error messaging for 404s #5350

analogrelay opened this issue Oct 10, 2018 · 14 comments
Labels
affected-few This issue impacts only small number of customers area-signalr Includes: SignalR clients and servers enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-client-java Related to the SignalR Java client feature-client-javascript Related to the SignalR JS client feature-client-net Related to the SignalR .NET client help candidate Indicates that the issues may be a good fit for community to help with. Requires work from eng. team severity-nice-to-have This label is used by an internal tool
Milestone

Comments

@analogrelay
Copy link
Contributor

Usually a 404 occurs because sticky sessions are not enabled. We should provide a better error message here.

@ptallett
Copy link

Also if the server has a bug and doesn't expose the hub properly, you get an "Error negotiating: error" which makes you think its actually communicated with the server when in fact it hasn't.

I'd think messing up the hub definition on the server is quite common for newbies.

Cheers,
Paul

@analogrelay
Copy link
Contributor Author

Also if the server has a bug and doesn't expose the hub properly

Can you elaborate on what you mean by "doesn't expose the hub properly"?

@mikaelm12
Copy link
Contributor

I think @ptallett means when you incorrectly configure map hub and the client try to a wrong hub url.
We get an unexpected status code returned from negotiate: 404.

@davidfowl
Copy link
Member

davidfowl commented Oct 11, 2018

There's nothing we can do about that. If you point your client at www.google.com, we don't get a chance to handle it properly. Maybe we could log the mapped hubs at startup and the URL they are bound to. I'm not sure what we could do on the client side besides improve the error message to say we didn't find the negotiate response?

@analogrelay
Copy link
Contributor Author

I think the ask here is to have an error that actually says we got a 404. At the moment I believe we have a very obscure error. That seems entirely legitimate.

@davidfowl
Copy link
Member

I see. This is across all the clients right?

@analogrelay
Copy link
Contributor Author

The JavaScript client is the one with the worst error messages :). The others are pretty good already.

@analogrelay
Copy link
Contributor Author

The easiest fix here is to detect the kind of 404 we get. Once a 404 is received:

  1. Have the client detect the Connection ID Required error message and throw an error that points to docs on Sticky Sessions. Something like The server does not have a record of the current connection. This usually occurs when you are using multiple server instances and don't have Sticky Sessions enabled. See https://aka.ms/[something] for more information.

  2. If the Connection ID Required message is not in the body, it's a more "standard" 404. Throw an error like A SignalR Hub could not be found at '[url]'.. Usually this will be caused by bad routing configuration.

@analogrelay
Copy link
Contributor Author

We should do this in all the clients. The JS client is the worst because it has no 404 error (it just says "Error"), but the Java and .NET clients could use the detection logic in 1 above.

@aspnet-hello aspnet-hello transferred this issue from aspnet/SignalR Dec 17, 2018
@aspnet-hello aspnet-hello added this to the 3.0.0 milestone Dec 17, 2018
@aspnet-hello aspnet-hello added area-signalr Includes: SignalR clients and servers feature-client-net Related to the SignalR .NET client feature-client-java Related to the SignalR Java client feature-client-javascript Related to the SignalR JS client cost: S labels Dec 17, 2018
@bradygaster bradygaster modified the milestones: 3.0.0, 3.0.0-preview4 Feb 6, 2019
@muratg muratg modified the milestones: 3.0.0-preview4, 3.0.0-preview5 Feb 25, 2019
@analogrelay analogrelay added release-3.0 enhancement This issue represents an ask for new feature or an enhancement to an existing one Needs: Design This issue requires design work before implementating. and removed type: Enhancement labels Mar 21, 2019
@analogrelay analogrelay added the help wanted Up for grabs. We would accept a PR to help resolve this issue label May 30, 2019
@analogrelay
Copy link
Contributor Author

Clarifying further. The work we're doing here is to change all three clients to explicitly detect a 404 response and then throw a specific error (rather than the generic error we throw now) that says something like: "The connection could not be found on the server, either it is not a SignalR endpoint, or the connection may not be present. ... something something try enabling sticky sessions ..."

@analogrelay
Copy link
Contributor Author

analogrelay commented Jul 9, 2019

The work for this repo:

  • Change error to say "something something 404s. For more detail see https://aka.ms/signalr/404s"
  • Log this in the client logs
  • Check if aka.ms can be used in code ;)

The work for docs (engineering team to do this) (cc @scottaddie):

  • Add a "Troubleshooting" doc with a section on 404s
  • Update the aka.ms to point at it.

@analogrelay
Copy link
Contributor Author

This is cut for 3.0. This can probably meet the bar for 3.1 though.

@analogrelay analogrelay added 3.1-candidate and removed PRI: 3 - Optional Needs: Design This issue requires design work before implementating. labels Jul 26, 2019
@analogrelay analogrelay modified the milestones: 3.0.0-preview8, Backlog Jul 26, 2019
@jogibaeratvega
Copy link

You receive a 404 when your JWT-Token you send in the query param is to large:

Error during WebSocket handshake: Unexpected response code: 404

@pranavkm pranavkm removed the cost: S label Nov 6, 2020
@BrennanConroy BrennanConroy added affected-few This issue impacts only small number of customers severity-nice-to-have This label is used by an internal tool labels Nov 6, 2020 — with ASP.NET Core Issue Ranking
@mkArtakMSFT mkArtakMSFT added help candidate Indicates that the issues may be a good fit for community to help with. Requires work from eng. team and removed help wanted Up for grabs. We would accept a PR to help resolve this issue labels Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected-few This issue impacts only small number of customers area-signalr Includes: SignalR clients and servers enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-client-java Related to the SignalR Java client feature-client-javascript Related to the SignalR JS client feature-client-net Related to the SignalR .NET client help candidate Indicates that the issues may be a good fit for community to help with. Requires work from eng. team severity-nice-to-have This label is used by an internal tool
Projects
None yet
Development

No branches or pull requests