SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

If you connect to SpacetimeDB with an invalid token in Unity it says "Connection error Unable to connect to remote server". This should be changed to tell you your token is bad.

Open cloutiertyler opened this issue 1 year ago • 6 comments

zeke investigation results so far

  • BitCraft has started handling this error better
  • The Unity SDK is just passing along the WebSocketException, which is not a type we construct (in the SDK)
  • The websocket error code is set to Success
  • Next steps: Investigate what sets these error details on the server side

cloutiertyler avatar Jun 11 '24 17:06 cloutiertyler

The error response message from SpacetimeDB needs to differentiate between connecting to a module that doesn't exist and a bad token. We do not currently do this. This is an API break.

cloutiertyler avatar Aug 19 '24 19:08 cloutiertyler

We just need to update this so that clients receive an error message that their token is invalid.

cloutiertyler avatar Sep 09 '24 21:09 cloutiertyler

It's worth saying that we're planning to rework identities & tokens pretty soon - maybe we should revisit this after that refactoring happens?

bfops avatar Sep 10 '24 03:09 bfops

I'll just note, that in a meeting with @jdetter we decided that the identities and tokens rework is not going to make this issue go away although hopefully it will make it less frequent.

cloutiertyler avatar Sep 23 '24 19:09 cloutiertyler

Empirical analysis shows this to be the SDK's problem, not the host's. The host sends a reasonable HTTP error response with a well-chosen status code and a human-readable description in the body in response to /database/subscribe calls with invalid tokens, and the Rust SDK is able to print these. (Currently it prints the status code but not the body, but it clearly receives the intended response.) Somewhere in the C# SDK, whether it's our code or the WebSocket library we use, the client is discarding that HTTP error response and printing something stupid and useless instead.

gefjon avatar Sep 25 '24 18:09 gefjon

We have determined that this is an issue in the C# SDK or C# websocket client specifically. It is correct in the API. Thus I'm moving this to 1.0.

cloutiertyler avatar Sep 25 '24 18:09 cloutiertyler

Fixed by https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk/pull/166

joshua-spacetime avatar Nov 04 '24 19:11 joshua-spacetime