Could not find a relationship between 'messages' and 'user' in the schema cache
I'm using the js client to try to attach a "user" to each "message". You can see from the attached screenshot that I have the user id setup as a fk. I believe this is all correct.
I have two RLS policies on
messages
:
I don't have any user table policies because those are locked (by design I think?)
Now, I'm getting the data like this
And I thought that this would give me the user as { ...message, user }
. But it's always returning null
. The messages have all been created with a valid user.
How can I debug this further?
5 Replies
You cannot access auth schema from the API.
Do you have a public user table?
Ah. No, I don't have a public users table. What's the normal pattern for this? Create a corresponding users table and then sync them? I feel this would be quite a common thing to try and do, so maybe there are docs/articles on it?
Yes.
User Management | Supabase Docs
View, delete, and export user information.
Oh nice, that's perfect! Thank you very much 🙏