new Supabase user - query not returning anything (React) #3255
-
Hello, I have a populated table with row level security enabled in Supabase and I'm hoping to read some of that data into my SPA that I'm building in React. I've (checked) that I've correctly followed the documentation to store my database URL and API key, but when I actually run my query, I'm getting an undefined value for data back despite getting a 200 status. See below:
Any idea why this may be happening? I can't seem to figure out a way to solve this problem |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hi @mohnish7! It seems like you are getting empty array, which makes me think the row level security that you are setting is blocking this user from loading any data. Could you show the row level security rule that you applied to your database? |
Beta Was this translation helpful? Give feedback.
-
I'm suffering from the same problem originally reported by @mohnish7 with the exception that I have the following policy enabled for methods of interacting with public.organizaitons:
I'm using the supabase client in the browser to make requests against table. The return response has a status of 200 but an empty array in the payload. The related request is being sent with an apikey header that contains the anonymous apikey for the app and also includes an authorization header which contains the session token returned when the user logged in. Note, I'm using a cookie as described on this site. Any idea what I'm doing wrong? Also, why would the server return a status code of 200 for an authorized request? Shouldn't it be returning either a 401 or 403? |
Beta Was this translation helpful? Give feedback.
Hi @mohnish7!
It seems like you are getting empty array, which makes me think the row level security that you are setting is blocking this user from loading any data. Could you show the row level security rule that you applied to your database?