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

Frequent Validation failed for room errors in dev #164

Open
G2Jose opened this issue Sep 7, 2024 · 1 comment
Open

Frequent Validation failed for room errors in dev #164

G2Jose opened this issue Sep 7, 2024 · 1 comment

Comments

@G2Jose
Copy link

G2Jose commented Sep 7, 2024

I seem to be running into this error a lot:

ERROR Validation failed for room {"client-event-id": "xxx", "op": "error", "original-event": {"client-event-id": "xxx", "data": {"id": "xxx", "online": true}, "op": "set-presence", "receive-q-delay-ms": 0, "room-id": "main", "session-id": "xxx", "total-delay-ms": 0, "worker-delay-ms": 0}, "status": 400, "type": "validation-failed"}
ERROR This error comes with some debugging information. Here it is:
{"data-type": "room", "errors": [{"message": "You have not entered this room yet."}], "input": {"app-id": "xxx", "room-id": "xxx", "session-id": "xxx"}}

(I've redacted actual ids for security).

The relevant part of the error seems to be You have not entered this room yet.

What am I doing wrong in this code? The docs don't indicate having to do anything to enter a room.

function usePresence() {
  const userId = useAppSelector(getCurrentUserId)
  const appState = useAppState()

  room.useSyncPresence({ id: userId, online: appState === 'active' })

  const presence = room.usePresence()

  return presence
}

const Component = () => {
  const { peers } = usePresence()
  return <SomeView />
}

Things I've tried:

  1. Reloading the javascript in the app (hitting r on expo cli) doesn't help, the error reappears after the refresh
  2. Fully closing the restarting the app (including javascript) doesn't help either
Platform: Android emulator
Version: @instantdb/react-native: 0.12.26
@nimonian
Copy link

Just an FYI I remember this being mentioned on the Discord server and someone said it was a bug.

I experience the same thing and I believe your code is fine. If I refresh several times, sometimes the bug goes away.

Hopefully it is fixed soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants