hey guys! Supabase newbie here. I have just done...
# help
d
hey guys! Supabase newbie here. I have just done a 'login' page and now trying to retrive data from the fetch API. When i try this i get an error: "permission denied for table [name]" code 42501. Do you need to pass in any clever credentials or is it smart enough to cover the auth tokens etc? RLS is disabled so not sure how to resolve.
n
Hello @DesertRodent! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
g
Are you using a client or forming your own requests? Do you have your client initialized with anon key? Are you passing in Authorization header if not using client? Are you doing a select or some other operation (retrieve sounds like select)?
d
I am using the anon / public key, using the supabase client import { createClient } from '@supabase/supabase-js' const supabase = createClient( process.env.REACT_APP_SUPABASE_URL, process.env.REACT_APP_SUPABASE_PUBLIC_KEY ) export default supabase and i am trying to do a simple query: let { data: services, error } = await supabase.from('services').select('*')
g
How did you create the table?
d
ill be honest, my back end sql dev migrated from an old cloud based implementation of PG
i tried running a query from this: https://github.com/supabase/supabase/issues/4883
but didn't work
g
maybe your tables don't have grants for anon, authenticated etc.
try this on that table in the sql editor: GRANT ALL PRIVILEGES ON "TABLE" TO postgres,anon,authenticated,service_role where "TABLE" is your table name.
d
trying now
amazing..thanks!
i knew it would be something simple 🙂