Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabaseβ€’4mo agoβ€’
3 replies
C&L

Why can't I insert a row in my table which is in a new schema?

Hi all,

I am connecting the schema landingpage from my Supabase database to my website where anon users can insert a row in the table visits.

Row Level Security is enabled.

I have the below policy:

alter policy "Allow anon insert"
on "landingpage"."visits"
to anon
with check (
true
);

And below is the js code on my website:

import { createClient } from 'https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm';
const supabase = createClient(
supabaseUrl,
supabaseKey,
{
db: { schema: "landingpage" }
}
);
const { error } = await supabase
.from('visits')
.insert({ country: countryName })
.select()
if (error) console.error('Insert error:', error)

But I get the below error message:

Insert error: {code: '42501', details: null, hint: null, message: 'permission denied for table visits'}
(anonymous) @ index.js:102

What could be the issue?

I would appreciate it if anyone could help me in this.
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Create new table on row insert
SupabaseSSupabase / help-and-questions
4y ago
Can’t edit my row in supabase table
SupabaseSSupabase / help-and-questions
4mo ago
Insert method, can't insert data
SupabaseSSupabase / help-and-questions
4y ago
Insert row into RLS enabled table from edge function using new keys
SupabaseSSupabase / help-and-questions
7mo ago