© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
4 replies
abelsoares

supabase client expose error

Hi all, new to supabase, being working with the supabase client and when making an update to a table record which has a RLS policy that only let's owners update their records the record is not updated as expected but i get no error. The response is
{ error: null, data: [], count: null, status: 200, statusText: 'OK' }
{ error: null, data: [], count: null, status: 200, statusText: 'OK' }


I was expecting to get an error indicating that i cannot update the record. Is this the expected behaviour?

Here is the relevant code:
table and RLS
CREATE TABLE "public"."user_posts"(
    id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
    user_id uuid REFERENCES auth.users(id) ON DELETE CASCADE,
    title varchar(255) NOT NULL,
    body text NOT NULL,
    created_at timestamp with time zone NOT NULL DEFAULT now(),
    updated_at timestamp with time zone NOT NULL DEFAULT now()
);

ALTER TABLE public.user_posts ENABLE ROW LEVEL SECURITY;

CREATE POLICY "Allow users to create their own posts" ON user_posts
    FOR INSERT TO authenticated
        WITH CHECK ((
            SELECT
                auth.uid()) = user_id);

CREATE POLICY "Allow users to update their own posts" ON user_posts
    FOR UPDATE TO authenticated
        USING ((
            SELECT
                auth.uid()) = user_id)
            WITH CHECK ((
                SELECT
                    auth.uid()) = user_id);
CREATE TABLE "public"."user_posts"(
    id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
    user_id uuid REFERENCES auth.users(id) ON DELETE CASCADE,
    title varchar(255) NOT NULL,
    body text NOT NULL,
    created_at timestamp with time zone NOT NULL DEFAULT now(),
    updated_at timestamp with time zone NOT NULL DEFAULT now()
);

ALTER TABLE public.user_posts ENABLE ROW LEVEL SECURITY;

CREATE POLICY "Allow users to create their own posts" ON user_posts
    FOR INSERT TO authenticated
        WITH CHECK ((
            SELECT
                auth.uid()) = user_id);

CREATE POLICY "Allow users to update their own posts" ON user_posts
    FOR UPDATE TO authenticated
        USING ((
            SELECT
                auth.uid()) = user_id)
            WITH CHECK ((
                SELECT
                    auth.uid()) = user_id);

And the client code:
... 
    supabase.auth.setSession({ access_token: accessToken, refresh_token: refreshToken })

    const { data: { user } } = await supabase.auth.getUser();

    const response = await supabase
        .from('user_posts')
        .update([
            {
                body: faker.lorem.text(),
                title: faker.lorem.sentence(3),
            }
        ])
        .eq('id', id)
        .select();

    if (response.error) {
        throw new Error(response.error.message);
    }

    return response;
...
... 
    supabase.auth.setSession({ access_token: accessToken, refresh_token: refreshToken })

    const { data: { user } } = await supabase.auth.getUser();

    const response = await supabase
        .from('user_posts')
        .update([
            {
                body: faker.lorem.text(),
                title: faker.lorem.sentence(3),
            }
        ])
        .eq('id', id)
        .select();

    if (response.error) {
        throw new Error(response.error.message);
    }

    return response;
...
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Does supabase expose postgres transactions?
SupabaseSSupabase / help-and-questions
3y ago
expose `pgmq_public` to client
SupabaseSSupabase / help-and-questions
14mo ago
Expo error while importing supabase client
SupabaseSSupabase / help-and-questions
13mo ago
Coolify + Supabase, how to expose the postgres port ?
SupabaseSSupabase / help-and-questions
9mo ago