All Questions
Tagged with supabase supabase-js
149
questions
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/...
4
votes
3
answers
2k
views
Supabase reset password error: "Auth Session Missing"
The following function fails with error "Auth Session Missing"
const { error } = await supabase.auth.updateUser({
password: password,
});
After getting the reset password link on my mail ...
4
votes
2
answers
3k
views
Supabase "TypeError: fetch failed"
I am making a to-do list application with Supabase and NextJS-13 and while fetching the lists from Supabase, the server gave me this error
Error Image
My List table on Supabase has three columns:
id
...
3
votes
1
answer
682
views
Query a timestamp range in supabase
I have a table in my supabase database with two columns start end end. Both are of type timestampz. Now I want to query all entries where the current timestamp (Date.now()) is inbetween start and end.
...
3
votes
2
answers
1k
views
How to modify a Supabase table from the dashboard UI or the Supabase SQL editor?
Whenever I try to modify an existing table in the Supabase dashboard, I get this error "Failed to pg.columns: must be owner of table <table_name>". This seems to be like a permission ...
3
votes
0
answers
342
views
ReferenceError: window is not defined in React Native project after adding Supabase call
I'm using a React Native project with Expo v49, and I added a Supabase call to read some data from the database, and it works on ios/android,
But when I open the web version, I get "...
3
votes
0
answers
390
views
Supabase SELECT with function call
From Javascript, I want to call a function in my supabase select statement (funcition name is id_encode in this example):
const { data, error } = await supabase
.from('table')
.select(&...
3
votes
2
answers
434
views
Supabase Realtime detecting duplicates for the same event
I have a simple page where I'm inserting a message into a message table and then on the frontend detecting it. I have used the sample code provided.
However, everytime, I seem to be detecting 3 events ...
2
votes
1
answer
1k
views
Is there a better way to access Supabase generated TS types?
I have created a table called customer in my supabase db.
Generated my types using
npx supabase gen types typescript --project-id "$PROJECT_REF" --schema public > types/supabase.ts
In my ...
2
votes
1
answer
2k
views
Supabase update with incrementing value
I am using supabase-js and have a table like this:
userID: string
timesVisited: number
eventName: string
I am using update like this:
Admin.from(tableName).update([{userID,eventName,timesVisited}])
...
2
votes
1
answer
692
views
Supabase and Cloudflare Workers
How do i protect a Cloudflare Worker route to authorize only if the user is authenticated on Supabase?
I'm using Cloudflare Pages Function to create a worker inside the Cloudflare Pages: https://...
2
votes
1
answer
772
views
How to escape string characters in supabase js OR query?
I'm trying to write a query that matches rows where a user-provided string matches one of two text array columns.
For example, imagine a table messages with text columns greeting and goodbye:
// WORKS
...
2
votes
1
answer
949
views
Nextjs 13 Supbase auth redirect post social login not working properly
I am having some trouble getting Supabase auth working properly in NextJS 13. I would like some pages to be protected and if the user navigates to those pages, they should first be redirected to the ...
2
votes
3
answers
746
views
react native supabase auth with google redirect issue & no session update
I am a little confused about trying to make a redirect URL to go along with the openAuthSessionAsync in app mobile browser view (docs: https://docs.expo.dev/versions/latest/sdk/webbrowser/#...
2
votes
0
answers
276
views
How can I get the image that OpenAI API returns and upload it to Supabase Storage?
I tried using the URL that is returned by default but there is a CORS issue on OpenAI's end which won't allow me to use fetch. So now I am trying to use b64_json but I cannot figure out how to get ...
1
vote
1
answer
999
views
Supabase JavaScript data fetching with nested select
I am new to supabase and data fetching via supabase-js client.
When I have the tables below and I have to fetch votes and additionally data from the result and club table, how does this work? ...
1
vote
2
answers
101
views
How can I sign out a user with Supabase from an express API endpoint?
I am using node and express as a backend for API endpoints with Vite as a frontend. So far, I have been able to send info from frontend to backend for signing in and signing up a user. However, I've ...
1
vote
1
answer
573
views
Multiple join in Supabase JS
I have 3 tables in supabase.
Message --> with foreign key 'request_id' to table Product_Request
Product_Request --> with foreign key 'product_id' to table Product
Product
How can i select all ...
1
vote
2
answers
823
views
Supabase trigger function works differently via client than direct manipulation does
I have a trigger function that runs after insert/delete on a table, but seems it's only working as expected when i add rows directly into the DB in supabase console, but when I do inserts/deletions ...
1
vote
1
answer
358
views
supabase - How to prevent to not logged users to see vue app pages
I'm starting use supabase as an alternative to firebase. I'm implementing a siple authentication system for my vue webapp, I have a doubt about redirection.
I've used the magic link solution to let ...
1
vote
2
answers
416
views
Return is executed before getting session in react using Supabase
I want to somehow get my return value after getting session.
App.jsx file
import { useEffect, useState } from 'react'
import './App.css'
import {Navigate} from 'react-router-dom'
import { supabase } ...
1
vote
2
answers
57
views
How to Use AND Operator with OR Condition in Supabase Query?
I'm working on a query in Supabase where I need to select specific columns from a table based on multiple conditions. Specifically, I need to select columns a, b, and c from a table where column e is ...
1
vote
1
answer
132
views
Supabase Auth UI + Google Sign in not reaching AuthProvider
I'm using Vite + React Router v6 + Supabase Auth components with a Google OAuth provider. I double checked that the Google credentials are in Supabase configuration, https://{my_supabase_id}.supabase....
1
vote
2
answers
683
views
Supabase nested join table query issue
I have 2 tables
users: {
id,
name
}
friends: {
id,
requestSentBy: relation(users_id),
requestSentTo: relation(users_id)
}
and what i want to achieve is get the user table with all ...
1
vote
1
answer
575
views
supabase select on nested entity
I am using Supabase and can use the client to retrieve nested data. However, I cannot work out how to select WHERE an Id matches a foreign key on the top level select.
Here is the query:
const {data} =...
1
vote
1
answer
831
views
Supabase - How can I skip the email confirmation stage of signing up, using auth-helpers for nextjs and the 'pages' directory?
Originally, I was performing client-side authentication in my NextJS app using the supabase-js library. However I'm switching over to using the auth-helpers-nextjs library for authentication so that I ...
1
vote
1
answer
2k
views
Supabase won't take UPDATE query
I'm currently using supabase to make quick MVP for college work. I create feedback feature, so I have to update some columns in row. There is my JS query:
const { error: updateError } = await supabase....
1
vote
1
answer
711
views
Supabase query go get parent record with at least one child record?
I got two tables, customer (parent) and order (child) with a foreign key relation. Is there a query using the javascript SDK to get all parent records that have at least one child record? Using prisma,...
1
vote
1
answer
3k
views
Could not find the function in the schema cache ( RPC supabase )
Hi I have created a postgres function using the supabase ui with 4 parameters.
see this screenshot
function definition is
begin
insert into public.rooms (created_by_id, room_manager_id, room_name, ...
1
vote
1
answer
34
views
supabase auth ui not redirecting after successful sign in
I have followed: https://supabase.com/docs/guides/getting-started/tutorials/with-sveltekit?language=ts and verified that everything runs correctly and all files are in the right place/have the correct ...
1
vote
1
answer
45
views
500 SupabaseUrl is required error when deployed on Netlify
I developed an application using NuxtJs3 + supabase. I am using the @nuxtjs/supabase module as well. On my local dev things are working fine but when I deployed this on Netlify, I had the below error-
...
1
vote
1
answer
345
views
Supabase & NodeJS: Invalid claim: AuthApiError: invalid claim: missing sub claim with getUser(jwt)
I have a custom backend that needs to authenticate users before letting them request some Express endpoints.
It works that way: NextJS (front-end) sends a request to NodeJS/Express (backend) with a ...
1
vote
0
answers
190
views
supabase.auth.signInWithOAuth is returning an URL with #
I'm using ExpressJS and Supabase Auth to create a Sign In with Google Button. So, after a user click on a button, it will be redirect to the route "/login/google" and their, will be redirect ...
1
vote
1
answer
219
views
How to Dynamically Add Metadata to JWT Tokens in Supabase for Same User when signing in from Different Platforms
I am working on a project with two platforms, a Mobile App and an Admin App, both using Supabase for user authentication. I want to control data access for users based on the platform they are signed ...
1
vote
0
answers
36
views
Supabase auth state lags behind when used in Root Layout (Next.js App router)
I've encountered an unusual behavior in my Next.js app (latest version, using App Router) integrated with Supabase Auth. I'm leveraging the Supabase auth state to conditionally render login/logout ...
1
vote
1
answer
192
views
What is causing the error Cannot find name 'useSupabaseClient'. when using Nuxt 3 and Supabase?
Using npm I have installed Nuxt 3 and Supabase but in vs code I keep getting the following error;
Cannot find name 'useSupabaseClient'.
When I run npm run dev I get the following error message on the ...
1
vote
0
answers
189
views
How to link supabase table with foreign key to User Data, using NestJS and typeorm?
I just create a Supabase DB using NestJS and TypeORM. I have some entities like this:
@Entity()
export class UserService {
@PrimaryGeneratedColumn()
id: number;
@OneToOne(type => User)...
1
vote
0
answers
217
views
Electron : how to manage user auth in main and renderer process?
I am building an Electron App with this user flow:
1- User logs in
2- Enters local db credentials
3- App fetch local db every X minutes
4- App sends data to somewhere else logged in as the user
Since ...
1
vote
0
answers
224
views
Disable supabase reads but allow real-time updates to anon and authenticated
I want to use supabase only for real-time updates of the PostgreSQL database.
Meaning that I don't want to allow anon/authenticated to read/update/insert/delete, but only want to push live changes ...
1
vote
0
answers
227
views
Unable to get updated session in Supabase after password login
I have this code which signs in a user in a sign in page:
else if (type === "password") {
if (password1.length < 6) {
toast.error("Password must be at ...
1
vote
0
answers
798
views
Can't get the user's session on the server side using Supabase
I'm reading these Supabase authentication tutorials (for example this one) where they feature some code on Next.js' API routes like this:
(pages/api/getUser.js)
export default async function getUser(...
1
vote
0
answers
314
views
Supabase Dashboard error (self-hosting): "Failed to create user: User not allowed", when i try to create a new user
When I try to create a new user I receive the following error, does anyone know why it happens?
I'm new to supabase and don't have much experience.
supabase dashboard error
In the .env file, the only ...
1
vote
1
answer
314
views
How can I call a function within the main function - supabase?
i have this function when a user signs up I insert some data to the profiles table,after that,
I want to generate a code digit and insert it into the paring_codes tablebut I got this error in LOGs
...
1
vote
0
answers
746
views
Getting "code challenge does not match previously saved code verifier" error on supabase github auth
I was trying to make github auth work on an next.js application with supabase, everything seems to work but when the user is redirected back from github to the site, the site encounters an supabase ...
1
vote
0
answers
542
views
Supabase-js: querying foreign table returns null
I have a table Requests with 2 foreign keys referencing auth.users and Categories
Requests
------------------------------------------------------------------------------
| user_id (= auth.users.id) | ...
1
vote
0
answers
68
views
Unable to Update first_name and last_name Columns in public.profiles Table Using Supabase (React Native)
I'm working on a project that uses Supabase as the backend, and I've set up a public.profiles table to store user profile information. The table structure looks like this:
create table
public....
1
vote
1
answer
457
views
Supabase automatically rearranging table rows
I have a supabase table with a column of boolean type, whenever I change the value to TRUE or FALSE, the rows get rearranged automatically putting rows with set to TRUE at the top.
I want rows to be ...
1
vote
0
answers
562
views
Upsert and return all rows with supabase-js
I'm using the supabase js client. I have an array of records I'd like to insert into my table and return. The records must be unique, so if they already exists in the table they should be ignored, but ...
1
vote
1
answer
285
views
How can I access supabase bearer tokens in nuxt3 in a type save way?
I am using supabase with nuxt3. I also have an API backend which would use that bearer token to authenticate its API calls.
This is the code:
<script setup lang="ts">
const { auth } =...
1
vote
1
answer
779
views
Issue with Supabase Auth + Next.js setup using pages directory
I am currently working on a project that involves setting up Supabase Auth with Next.js. I have followed the documentation provided by Supabase (https://supabase.com/docs/guides/auth/auth-helpers/...