All Questions
Tagged with supabase javascript
275
questions
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/...
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....
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 ...
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 ...
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&...
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:
...
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 ...
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] = ...
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": &...
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, ...
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 ...
5
votes
1
answer
4k
views
Is there a way to perform full text search on multiple columns on Supabase with Javascript?
I've tried using many symbols to separate columns; ||, |, &&, & with and without spaces.
For instance
.textSearch("username, title, description", "...");
.textSearch(&...
5
votes
2
answers
3k
views
How to change the redirecting url for Google OAuth with supabase?
I am trying to set up a website with supabase using Google OAuth for authentication.
It's fairly easy and convenient to set up and works really well, by following this tutorial and consulting the docs....
5
votes
2
answers
2k
views
How to pass in parameters from client side to server side code in Sveltekit?
I've been trying to run a query to a Supabase database that needs a dog breed passed through and will return metrics about it, the breed is defined on the client side. I was able to get the server ...
5
votes
1
answer
2k
views
Access supabase database from edge function as admin
I'm coming from Firebase Function... Where I can use the Admin Library to access database from the Function bypassing all security rules? On supabase I didn't yet find a way to do that, the ...
5
votes
2
answers
524
views
Error in handling error messages for login: http://localhost:3000/auth/login net::ERR_ABORTED 405 (Method Not> Allowed)
I have this /app/auth/login/route.ts
import { createRouteHandlerClient } from '@supabase/auth-helpers-nextjs'
import { cookies } from 'next/headers'
import { NextResponse } from 'next/server'
export ...
4
votes
1
answer
412
views
Supabase Auth UI: show the sign up UI not the sign in UI?
I am using Supabase Auth UI as the login / sign up auth provider for my website.
Currently the Auth UI always shows the login button. I can get onto the sign up UI by clicking "Don't have an ...
4
votes
1
answer
6k
views
supabase.auth.getUser() returns error on vue-router route guard
I am attempting to build a Vue application that uses Supabase authentication. Inside one of the route guards in the router file, I implemented supabase.auth.getUser() in order to retrieve the user ...
4
votes
1
answer
5k
views
How to insert timestamp without timezone using Supabase-JS client?
I want to insert current timestamp without timezone to Supabase.
I know I can set default value of the timestamp column to NOW() but
there can be some delay in the timing and I need it precise.
I ...
4
votes
1
answer
2k
views
supabaseUrl is required sveltekit
I'm having this problem for quite a while and want to solve this:
According to supbase documentation you create a .env file
VITE_SUPABASE_URL="YOUR_SUPABASE_URL"
VITE_SUPABASE_ANON_KEY="...
4
votes
4
answers
2k
views
Supabase Edge function says no body was passed
I'm invoking a supabase edge function with the following
async function getData(plan_data){
console.log(plan_data)
console.log(JSON.stringify({plan_data}))
const { data, ...
4
votes
1
answer
1k
views
How to use bigint safely with Supabase JS
Postgres' bigint type holds 64 bit integers. But the Supabase JS library returns those values as JS numbers, which cannot safely store 64 bit integers AFAIK. What would be the correct way to handle 64 ...
4
votes
1
answer
3k
views
Error when trying to call a supabase edge function
I am trying to call a supabase edge function in javascript but I am getting this error:
access to fetch at 'https:/blablala.functions.supabase.co/hello-world' from origin 'http://localhost:5173' has ...
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
...
4
votes
2
answers
626
views
Upload image after clicking on submit button, not on input change
I want to create a form that uploads the images to Cloudinary and then gets the image's URL and parses it into Supabase database, but I only want to upload the images when I click the Publish button (...
4
votes
0
answers
963
views
Supabase SSR getSession always returns null
I've tried to check for session on server side in my NextJS project. I've used supabaseService client and also "createServerSupabaseClient" from @supabase/auth-helpers-nextjs both of those ...
3
votes
4
answers
6k
views
supabase bucket policy to insert file not working
I am trying to insert a file into a supabase public bucket, I've created basic policies to insert, select. when I try to upload a file though it returns
{
statusCode: '401',
error: 'Invalid JWT',
...
3
votes
3
answers
7k
views
Supabase onAuthStateChanged - How do I properly wait for the request to finish prevent flickering with useEffect?
Everything auth-wise is working fine. I even have a loading state setup so that the loader shows until the state is changed, but I still get this flickering on reload. This flickering only happens ...
3
votes
2
answers
233
views
Supabase puts certain rows at the top
My Supabase JS client performs an INSERT on the messages table using the following.
import { createClient } from "@supabase/supabase-js";
const supabase = createClient(
"MY ...
3
votes
1
answer
3k
views
AuthRetryableFetchError with Supabase Auth
I've recently rewritten parts of my Supabase webapp, but something started to crash. When I call handleSignIn with the form on my site it refreshes (obviously no session is set nor any user is logged ...
3
votes
1
answer
876
views
Supabase and Google Apps Script
Is it possible to use Supabase with Google Apps Script (GAS)?
I'm new to Supabase and I've never tried to import external library to GAS before. I'm planning to use Supabase as a database for my ...
3
votes
1
answer
4k
views
Nuxt.js3 plugin's context becomes undefined
I am developing an application using Nuxt.js3 and supabase.
Nuxt.js in plugins/supabase.server.js (I haven't figured out if server or client is better for this too.) I want to use "supabase = ...
3
votes
2
answers
168
views
Input type hidden value not being recognized when deployed on vercel
Whenever, I try to update the data on Vercel, this is the error that it shows:
invalid input syntax for type uuid: "undefined" - unable to save
However, it successfully updates the data ...
3
votes
1
answer
395
views
Dynamic social sharing cards populated in <svelte:head>
I've built a blog website and am trying to implement dynamic social share cards for each individual blog. While everything appears to be working properly when I inspect the head element in developer ...
3
votes
1
answer
123
views
Act on Behalf of GitHub User With Supabase Auth
I have a JavaScript browser app, and a ASP .NET Core Minimal API backend. The database is Supabase and the user authenticates with the GitHub Supabase auth provider.
The app, whether backend or ...
3
votes
0
answers
67
views
Supabase JavaScript Client multiple joins
I am facing a problem with my supabase + Nuxt application
In Supabase I have setup the following tables. Users, Events and a many-to-many reference table called Guests.
1 User can host 1 event
n ...
3
votes
0
answers
994
views
GetStaticProps Revalidate is not working as expected
Problem:
Revalidate doesn't work when im useing (serverSideTranslations) from next-i18next. Please see my code below.
When a new user register, an static page is generated for each language: (da (...
3
votes
3
answers
1k
views
How to implement cookie authentication with Sveltekit & Supabase?
I'm fairly new to both SvelteKit & Supabase and have done a bit of experimentation on my own, but I would like to know what is the best way to implement user authentication with both of these ...
2
votes
2
answers
3k
views
How to use the signUp() method in Supabase to add additional user info when signing up
I am attempting to build a Vue.js application that includes authentication with Supabase. I wish to use the built-in Supabase signUp() method to handle additional user data when signing up. To do this,...
2
votes
1
answer
2k
views
How to check if user already exists in Supabase?
How can I check if a user with the same email already exists when Enable email confirmations is turned on.
When Enable email confirmations are turned on an obfuscated / fake user object is returned by ...
2
votes
3
answers
5k
views
Row-level security problems when creating a supabase's bucket
everyone.
I'm new to Supabase and I'm exploring all the features available in this amazing platform. Unfortunately I'm having some troubles with bucket creation. I tried also create manually the ...
2
votes
2
answers
2k
views
Match PotsgreSQL timestamptz by exact value
I am using PostgreSQL 13.3 via Supabase.io. I have a table with a field called modified_at which has a type of timestamptz:
CREATE TABLE IF NOT EXISTS knowledge_views (
id uuid NOT NULL DEFAULT ...
2
votes
1
answer
6k
views
Supabase JSON query JavaScript
Im trying to fetch single entry from my table that contains and JSONB array of objects. Can I match somehow that array to find the desired result?
[
{
"chats": [
{ &...
2
votes
1
answer
4k
views
Cannot log out user on the server side (Next.js and Supabase)
How can I log out a user on the server side when using Supabase as the auth provider?
I thought the simplest and most obvious solution would be to just do that:
export const getServerSideProps: ...
2
votes
1
answer
1k
views
How to implement a callback when auth state changes in supabase
I'm struggling to implement an idea. If a user is logged in, I want to show a hidden div.
For example in firebase I can do this:
firebase.auth.signInAnonymessly()
// Detecting if the auth state ...
2
votes
1
answer
3k
views
Supabase: filter rows based on if any of their one to many relations has property
In supabase I have a list of tracks and each track can have multiple artists (kept in a separate table). I only want tracks in which at least one of the artists associated with that track contains a ...
2
votes
2
answers
2k
views
Can I Auth a user through Firebase and use Supabase (private) buckets without relying on Supabase Auth users limitation
I have an Ionic application that use a pretty small file(1kb) to store user info. I want to implement cloud backup for it. The user just need to download it once, when restoring backup. All other ...
2
votes
1
answer
4k
views
Count the occurrences of DISTINCT values using supabase
I want alternative supabase code for this SQL command
SELECT order_date,COUNT(*) as count
FROM orders
GROUP BY order_date
ORDER BY order_date Desc;
What I am trying to do is, I want the number of ...
2
votes
1
answer
2k
views
Can I use a service like Firebase or Supabase in a Tauri desktop application?
I am a full-stack web developer that has experience with JavaScript and React. I want to create a desktop application using these technologies using a framework like Tauri. I enjoy using services like ...
2
votes
1
answer
2k
views
Sveltekit update reactive variable from form action
Hi!
So I'm working on a simple crud application with Sveltekit and Supabase. I'm trying to implement this sorting feature by fetching the table with the added .order() function when the user selects a ...