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.

Filter by
Sorted by
Tagged with
36 votes
1 answer
45k views

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/...
Tom Wicks's user avatar
  • 855
32 votes
4 answers
29k views

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 ...
Poyraz HANCILAR's user avatar
27 votes
1 answer
44k views

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 ( ...
dshukertjr's user avatar
  • 17.4k
22 votes
1 answer
16k views

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/...
Max Silva's user avatar
  • 577
21 votes
4 answers
27k views

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 ...
dshukertjr's user avatar
  • 17.4k
19 votes
2 answers
9k views

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 ...
Sumit Ghosh's user avatar
  • 1,133
18 votes
8 answers
20k views

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 ...
rdavis's user avatar
  • 303
18 votes
3 answers
17k views

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 ...
Mat's user avatar
  • 585
18 votes
1 answer
8k views

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 ...
Bojan Krkic's user avatar
16 votes
2 answers
12k views

INSERT into the table and return id of the record Supabase JS

Based on the docs, inserting a new record const { error } = await supabase .from('countries') .insert({ name: 'Denmark' }) returns { "status": 201, "statusText": "...
Jingles's user avatar
  • 1,015
16 votes
3 answers
7k views

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 ...
Jakub Szlaur's user avatar
  • 2,042
14 votes
1 answer
7k views

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....
amatur's user avatar
  • 327
14 votes
1 answer
7k views

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 ...
alex2704's user avatar
  • 143
13 votes
5 answers
4k views

Multiple GoTrueClient instances detected in the same browser context

I'm creating a project with nextjs and supabase. For an unknown reason, I'm getting the following warning in the console: Multiple GoTrueClient instances detected in the same browser context. It is ...
maaajo's user avatar
  • 979
12 votes
3 answers
5k views

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, ...
Dragonsnap's user avatar
9 votes
3 answers
8k views

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 ...
Max's user avatar
  • 857
8 votes
3 answers
9k views

delete associated records in Supabase

When using Supabase, is there a clean / simple way in which I can delete all associated records together with an item? Say I have Posts and a Post can have many Comments. When I delete the Post I want ...
Sventies's user avatar
  • 2,600
8 votes
7 answers
3k views

Supabase Generate Types Failing

I am trying to run the command to update my typing via cli and it continues to give me the following error but when I debug this is all I get. Not much to work with. 2023/03/01 09:34:01 Recv First ...
Luke Longo's user avatar
8 votes
1 answer
5k views

Is there RESTful API available for auth features of Supabase

We are trying out Supabase and found it awesome, especially about how easy it is to implement user authentication. So far we have been using the official JavaScript client library and everything we ...
haochenx's user avatar
  • 153
8 votes
0 answers
766 views

Next JS - Supabase Error: AuthApiError: Invalid Refresh Token: Already Used

I'm trying to implement Supabase Auth in a Next JS project Now I'm encounter the following error which keeps repeating when I npm run dev: [AuthApiError: Invalid Refresh Token: Already Used]{ ...
Emad Naeim's user avatar
8 votes
0 answers
2k views

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. ...
notSoGreatCoder's user avatar
7 votes
1 answer
3k views

Can't migrate schema using Prisma with Supabase

When I use the Postgres database on Supabase I run the following command, npx prisma migrate dev --name init, but I get the following error (first command in screenshot): Error: db error: FATAL: ...
steve238's user avatar
  • 1,071
7 votes
1 answer
2k views

Supabase select and join a 1-1 relation with Typescript support

I have the following select query: return supabase .from("Content") .select(`*, Users (userId, firstname)`) .eq("Users.userId", "Content.userId") .eq(&...
Vallo's user avatar
  • 1,917
7 votes
3 answers
12k views

How to pass params in Nuxt 3 server/api?

I can't figure it out how to pass params to an anonymous function in Nuxt 3. index.vue: <template> <form @submit.prevent="signUpNewsletter()"> <input type="email&...
wittgenstein's user avatar
  • 4,142
7 votes
2 answers
2k views

PostgREST - Add authenticated user id on insert

I need to automatically add an author of an inserted row in one of its columns. I am using postgREST (using Supabase cloud service) and I don't want users to add whoever they want as the author. Is ...
TomasB's user avatar
  • 704
7 votes
1 answer
7k views

Supabase - Upsert & multiple onConflict constraints

I cannot figure out how to proceed with an Upsert & "multiple" onConflict constraints. I want to push a data batch in a Supabase table. My data array would be structured as follows: ...
Henri's user avatar
  • 1,661
7 votes
2 answers
7k views

How can I do select count(*) with "group by" in supabase-js?

How do I write a "group by" query in supabase-js? In traditional SQL it would look like this: SELECT COUNT(*), PLAYER FROM GAMES GROUP BY PLAYER Using React and supabase-js, my code so far ...
vikingsteve's user avatar
  • 39.4k
7 votes
2 answers
9k views

NextJS getServerSideProps pagination

I am using NextJS and Supabase for database. I am not sure how to use pagination here. Because the solution I am looking is passing query to the API. I cant do that because I am directly fetching it ...
kelly's user avatar
  • 115
6 votes
4 answers
6k views

supabase in Next JS returning an empty array when data is in relevant tables

It seems I am always returning an empty array when trying to pull data from my tables. This is how I am doing it, after following the docs and several tutorials. const [tableData, setTableData] = ...
mrpbennett's user avatar
  • 1,746
6 votes
2 answers
8k views

Supabase: how to query users by eMail?

I'm using Supabase in a Node JS middleware. I am developing an invite function thats receives an eMail address of an existing supabase user via a REST Endpoint. Now it should query the users table in ...
Niko Fischer's user avatar
6 votes
3 answers
5k views

Supabase returns empty array

I have a messages table , under a 'public' schema in Supabase. I'm trying to fetch all rows from my local dev environment, but nothing is returned. I'm trying: const response = await supabase.from('...
George Katsanos's user avatar
6 votes
5 answers
17k views

Error: supabaseUrl is required (supabase) postgresql

i'm using supabase postgresql online, in which important create a .env file where is my online DMBS's URL and anon key is saved and a "supabase client" file also create to access DBMS and ...
Muhammad tanzeel's user avatar
6 votes
2 answers
4k views

Cannot insert to table with authenticated role policy in Supabase

I'm trying to insert a row in my table which has RLS enabled and the Enable insert for authenticated users only policy added. Unfortunately, I cannot insert even though I'm correctly login. Steps to ...
KevinTale's user avatar
  • 1,788
6 votes
2 answers
5k views

How to download table created in supabase

I've created a table in supabase and filled it up with some data, Is there any way to download this table without interacting with supabase client? I want to save this as CSV file for future use but ...
risky last's user avatar
6 votes
4 answers
6k views

keep user logged in while using supabase in react native

I built an auth function that looks like this: const handleLogin = async (type) => { const { user, error } = type === "LOGIN" ? await supabase.auth.signIn({ email, ...
Menash Bouhadana's user avatar
6 votes
1 answer
2k views

Supabase signup() fails - signup not allowed

I am trying to signup a new user with email/password. I am on a free tier, and believe I have made the necessary settings. The Flutter code is: Supabase.instance.client.auth.signUp( email: 'abcde@...
Sunil Gupta's user avatar
6 votes
4 answers
1k views

Where can i find the graphiql explorer in Supabase?

Do you know where and how can i use a graphiql explorer to to see my schema and do some graphql request with Supabase ?
Tim's user avatar
  • 303
6 votes
2 answers
3k views

Use Supabase with deno

I'm trying to use Supabase with deno. I used import { createClient } from "https://esm.sh/@supabase/supabase-js" but it only gives me errors like Module '"deno:///missing_dependency.d....
Programmer Developement's user avatar
6 votes
2 answers
7k views

Error: Get config: Unable to establish a connection to query-engine-node-api library in Prisma and nextjs

I use nextjs fresh project with Prisma and supabase database. I'm using ubuntu. No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04 LTS Release: 22.04 Codename: ...
officialrajdeepsingh's user avatar
6 votes
1 answer
2k views

Deno / Postgres "invalid peer certificate contents: invalid peer certificate" error

I'm using deno db to connect to a supabase postgres server. Here's the error from deno deploy. TLS connection failed with message: invalid peer certificate contents: invalid peer certificate: ...
ThomasReggi's user avatar
  • 57.4k
6 votes
1 answer
3k views

supabase query for one-to-one foreign key, return single value (not array)

How can I query a one-to-one relationship with foreign key in supabase? My tables: games (id, created_at, played_at) results (game_id, key) Data: games ("id": 1, "created_at": &...
vikingsteve's user avatar
  • 39.4k
6 votes
2 answers
5k views

Supabase login get user session and profile at the same time

Is there a way to get the user session and profile at the same time? The way I did it would be get the user session first after login then fetch the user profile using the id. const [authsession, ...
Naterz's user avatar
  • 417
6 votes
0 answers
2k views

Running Supabase locally with DataGrip, 'relation "public.users" does not exist'

I'm running Supabase locally, using Docker, on MacOS. I initialized a Next.js project with Supabase, and connected the locally created database to JetBrains DataGrip. I can see and adjust the data in ...
sandypockets's user avatar
5 votes
7 answers
12k views

Filtering in join in supabase

Im using supabase with a database which have 2 tables (that are implicates in this issue). Tables are teachers and users. Both have ID and id_teacher/id_user respectively. Im working in a query where ...
Facundo Serrano's user avatar
5 votes
2 answers
7k views

Add aditional user information when signup supabase

I am trying to add additional data in a user record in supabase, I have created a trigger that is called after a record has been inserted in auth user that should add the user id and username in the ...
Richi's user avatar
  • 478
5 votes
3 answers
6k views

Error: "Only async functions are allowed to be exported in a 'use server' file"

I am trying to use layout.tsx in the app directory of Next.js 13 to have a nav layout that is present on all the pages. I managed to make it so that when the user logs out/signs in, the navbar changes,...
Vladimirzb's user avatar
5 votes
1 answer
4k views

How to save a file from Supabase Storage using Node.js (converting blob to file)

I am downloading media files (mainly images) from Supabase Storage using from.download() in NodeJS. How can I save the Blob that is returned as a file on my local hard drive?
st_phan's user avatar
  • 824
5 votes
2 answers
5k views

Supabase set password after email invite

In a Supabase app, I want to invite users (instead of them signing themselves up). I can invite a user with their email, but they get sent a link which directly authenticates them (like a magic link). ...
Sventies's user avatar
  • 2,600
5 votes
1 answer
3k views

How to upload to Supabase Storage using curl?

I see examples and manuals of uploading files to Supabase Storage for all client libraries, but no complete information for plain HTTP protocol (say, using curl). Both the Supabase Storage API's ...
tanius's user avatar
  • 15.6k
5 votes
3 answers
5k views

Supabase Add additional redirect URL not working

I'm trying to set up auth in supabase Following the tutorial, I try adding domain 'io.supabase.flutterquickstart://login-callback/' but nothing happens. Maybe this is a bug in the software, not sure
MobileMon's user avatar
  • 8,541

1
2 3 4 5
36