Questions tagged [supabase]

Supabase is a collection of open source tools to build modern applications quickly and efficiently. It uses the PostgreSQL database to power its authentication, database, and storage features. Use this tag when you are having problems, and not to ask for new features.

Supabase is a combination of open source tools. It builds the features of Firebase using enterprise-grade, open source products. Supabase is not a 1-to-1 mapping of Firebase. Its aim is to give developers a Firebase-like developer experience using open source tools.

Supabase has an official JavaScript library as well as community built Dart, Rust, Kotlin, C# and Python libraries.

Supabase is composed of four components

  • Database
  • Authentication
  • Storage
  • Functions (coming soon)
1213 questions
32
votes
1 answer

How to access route parameter inside getServerSideProps in Next.js?

I want to query my Supabase table using the ID in the slug e.g. localhost:3000/book/1 then show information about that book on the page in Next.js. Table book/[id].js import { useRouter } from 'next/router' import { getBook } from…
Tom Wicks
  • 785
  • 2
  • 11
  • 28
23
votes
1 answer

How to query using join in Supabase?

In Supabase documentation, it explains this as how you would "join" tables to get data const { data, error } = await Supabase .from('countries') .select(` name, cities ( name ) `) But how do I know this works every time when…
dshukertjr
  • 15,244
  • 11
  • 57
  • 94
21
votes
3 answers

Can't Resolve "encoding" Module Error While Using Nextjs-13 + Supabase

I'm trying to use Supabase for inserting/collecting data from my form. But when I compile I got encoding module is not found error. I already tried cache cleaning and re-installing npm modules. They didn't work either. Project…
Poyraz HANCILAR
  • 409
  • 1
  • 4
  • 12
16
votes
3 answers

How to get "COUNT(*)" in Supabase

I want to retrieve row count in Supabase. I am guessing it would be something like this: const { data, error } = await supabase .from('cities') .select('name', 'COUNT(*)') Is this possible with Supabase?
dshukertjr
  • 15,244
  • 11
  • 57
  • 94
14
votes
1 answer

Module not found: Can't resolve 'encoding' in '/vercel/path0/node_modules/cross-fetch/node_modules/node-fetch/lib'

Has anyone come across this non-breaking warning issue that you get with the npm package: @supabase/supabase-js The warning message: warn - ./node_modules/cross-fetch/node_modules/node-fetch/lib/index.js Module not found: Can't resolve 'encoding'…
Max Silva
  • 477
  • 1
  • 7
  • 15
14
votes
2 answers

How can I create an enum column in Supabase?

I want to create an enum column in a Supabase table. Supabase uses Postgres under the hood, so I understand that technically it is possible if I do it manually using SQL. But is there any way I can do it via the frontend in an easier manner?
Sumit Ghosh
  • 1,033
  • 10
  • 29
14
votes
3 answers

How to access custom schema from supabase-js client?

I love Supabase but our team needs to use schema functionality that PostgreSQL offers - unfortunately we have been unsuccessfully to make schemas working so far. Other info: PostgreSQL 14 newest version of the Supabase JS SDK's we have supabase…
Jakub Szlaur
  • 1,852
  • 10
  • 39
13
votes
1 answer

How to insert in multiple tables with a single API call in Supabase

This is the simplified structure of my tables - 2 main tables, one relation table. What's the best way to handle an insert API for this? If I just have a Client and Supabase: - First API call to insert book and get ID - Second API call to insert…
Bojan Krkic
  • 349
  • 3
  • 10
13
votes
1 answer

How can I send secure API requests from SvelteKit app, without showing API keys on the client side?

I'm using Supabase for a new Sveltekit app, with this template Currently, I'm passing the Supabase keys through on the client side, like this: const supabase = createClient( import.meta.env.VITE_SUPABASE_URL, …
amatur
  • 317
  • 2
  • 11
12
votes
6 answers

Supabase client permission denied for schema public

Whenever I've try to use @supabase/supabase-js to query the db, I get an error. error: { hint: null, details: null, code: '42501', message: 'permission denied for schema public' } I think it has something to do with Prisma, which I…
rdavis
  • 143
  • 1
  • 1
  • 5
10
votes
1 answer

How to implement anonymous authorization using Supabase?

Is there a way to implement anonymous authorization using Supabase? I have a mobile app and I want to implement the following functionality: Every user should have an account on the server right after the app installed. I'll use Device id as the…
alex2704
  • 103
  • 1
  • 5
9
votes
2 answers

Supabase bucket - new row violates row-level security policy for table "objects"

i am having an issue with uploading avatars to my supabase bucket as its giving me "new row violates row-level security policy for table "objects"". I tried other StackOverflow solutions and nothing. Before trying to upload I log in using supabse so…
Mat
  • 405
  • 4
  • 12
8
votes
3 answers

Supabase: Solutions for column-level security

Currently, I'm using a Supabase database. One of the big roadblocks that I'm facing is column-level security, which seems a lot more complicated than RLS. Say that I have a column called is_banned, that is viewable but not editable. However, the…
Dragonsnap
  • 834
  • 10
  • 25
8
votes
0 answers

Is there a way to generate the OpenAPI/Swagger definition from Postgres with object references?

I have a rest api using supabase/postgres(t) which generates it's own OpenAPI/Swagger definition. The problem is that this only contains the id fields but not actual references to the other tables. When generating a client with openapi-generater,…
8
votes
3 answers

Supabase, filter by column value of foreign key row

I am trying to figure out how to implement a query in supabase: Schema CREATE TABLE cars ( id SERIAL PRIMARY KEY, brand TEXT ); CREATE TABLE stores ( id SERIAL PRIMARY KEY, car INT REFERENCES car(id), name TEXT ); I want to…
Max
  • 754
  • 8
  • 24
1
2 3
80 81