All Questions
Tagged with supabase typescript
120
questions
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 ...
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
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(&...
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,...
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
4k
views
Supabase signInWIthPassword is giving me a 502 error
All auth functions work except signInWithPassword using React, TypeScript, and Supabase.
My context: It allows me to signIn, create a profile and move on. I am able to getUser() during the session ...
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
2k
views
Cannot destructure property 'supabaseUrl' of 'getConfig(...)' as it is undefined
I followed @supabase/auth-helpers-sveltekit guide on how to integrate supabase-auth helpers with sveltekit.
Yet, when running the dev server, I get an internal error
Cannot destructure property '...
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 ...
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
2
answers
535
views
extending nested interface generated by supabase
I have the following Typescript interface generated by Supabase
export interface definitions {
Users: {
/** Format: uuid */
id: string;
/**
* Format: timestamp with time zone
...
3
votes
2
answers
797
views
Supabase join returning 1 object instead of list of objects
I am trying to query my posts table for a post, which contains the user's user_id and I want to join it with the profiles table using the user_id.
post table schema: (post_id: uuid, created_at: ...
3
votes
1
answer
1k
views
Supabase types errors
Im using supabase with typescript and get some errors. I see them in webstorm, but not in vscode. Could u help me?
supabase
.channel('custom-all-channel')
.on(
'postgres_changes',
...
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
7k
views
Redirecting to Origin URL with Next.js Route Not Working
I'm currently working on a Next.js application where I have a layout component inside the app directory. Within that component, I have a navbar client component. I'm attempting to implement a logout ...
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
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
2
answers
2k
views
Supabase policies on getServerSideProps - Next.js
I'm crafting a Trello clone with Next.js and Supabase as a BaaS.
In my Supabase table I have this policies:
Policies are working grate on client side with the following code:
const { data } = await ...
2
votes
1
answer
214
views
How to get width / height of a base64 image in deno?
This is a repeat of this question: Get image width and height from the Base64 code in JavaScript but I am asking with regards to deno. Deno does not have the new Image() that is used in all the ...
2
votes
1
answer
806
views
supabase storage not downloading correctly
I am trying to download images that I have uploaded to my bucket as an ArrayBuffer as that is what is recommended by the docs when using react native. When downloading the file it returns a Blob. When ...
2
votes
1
answer
1k
views
Typescript error with SvelteKit and Supabase data fetching (Type 'null' is not assignable to type 'ArrayLike<unknown>')
I have a SvelteKit project set up which authenticates with supabase. I used this guide for that. The authentication and data fetching works fine so far. Actually, in terms of the app itself, ...
2
votes
0
answers
472
views
NextJs Supabase, Reset Password. Email verification token
I am using NextJs and Supabase to reset user password.
Below is my server action where i am calling resetPasswordForEmail function to send email to client mailbox
export const resetPasswordWithEmail = ...
2
votes
0
answers
133
views
How do i display a one to many relationship in Next js, supabase, typescript
I am trying to display the car renovating projects where i have all the projects in one table: projecten, and i have the images with a description in another tabel: projecten_images. I related the ...
2
votes
0
answers
725
views
How to use generics with Supabase generated database types?
I'm trying to use TypeScript generics based on the types generated by Supabase from the database, but haven't been able to make it work.
Here is what I'm trying to do:
type DbTables = Database['public'...
2
votes
2
answers
436
views
Pass a value from an api into an object as to insert a new row into the database
Using type=radio along with bind:group as shown in my example this will add the row to the database, but it only works for 1 entry plus the user needs to check the radio. Staring with just adding 1 ...
1
vote
1
answer
2k
views
Custom return type for Supabase
interface Account {
id: number;
username: string;
created: string;
}
export async function getAccounts() : Promise<Account[]> {
const { data, error } = await supabase
....
1
vote
1
answer
334
views
Refine.dev Fetching multiple records from different tables
How do you deal with fetching multiple records from two or more tables from the API using the useTable hook instead of useMany? Under the hood, useTable uses useList. Let's say I have customers and ...
1
vote
1
answer
428
views
Value of the select can be seen on the component. But when passing it to the server action, it does no show anymore
I am using Nextjs14 and Supabase.
I have this select where the user can choose from. I am also passing it on the formValue which will be received on the server actions as FormData. Now, on the ...
1
vote
1
answer
339
views
TypeScript: "Type is not assignable to type 'never'" with Conditional Types in Supabase Query
Question
I am working on a Next.js project using Supabase for the backend. I have defined some helper types to handle the responses from Supabase queries, but I'm running into a TypeScript issue that ...
1
vote
1
answer
639
views
Dynamic filters operation for supabase api
How to define type of filterOperation in this case?
let response = supabase.from('accounts').select(*)
Use:
response = response[filterOperation](field, value)
Instead of:
response = response.eq(field,...
1
vote
1
answer
248
views
Why does Typescript throw an error when I try to create Supabase client file?
I am quite new to SvelteKit and Typescript and I've recently tried uisng Supabase with SvelteKit (Typescript) and it all went well unil all of a sudden, after few projects Typescript began compalining ...
1
vote
1
answer
656
views
Supabase edge function running twice, but just one call
I have a relatively simple edge function in typescript at Supabase that connects to our postgres db and runs a query. The function is invoked via an html button. When run locally in the cli, or via ...
1
vote
2
answers
2k
views
How can I update data when user confirms email? Supabase Nextjs
I would like to update my profiles table once my user signs up with a magic link.
Here is my current code:
Login.tsx
import { useState } from "react";
import { supabase } from "../lib/...
1
vote
1
answer
862
views
Supabase Edge Functions not recognizing import map passed in `npx supabase functions serve`
I have two edge functions namely create-payment-link and retrieve-payment-link but the import map they're using is /home/deno/flag_import_map.json, and not the import_map.json file in the functions ...
1
vote
2
answers
840
views
Typescript Vuejs : Type 'Users[]' is missing the following properties from type 'ArrayConstructor': isArray, prototype, from, of, [Symbol.species]
I'm starting typescript with vuejs and I've just come across this error that I've been stuck on for 2 days.
The error is as follows: Type 'Users[]' is missing the following properties from type '...
1
vote
1
answer
555
views
SvelteKit/Supabase Type 'Session | null' is not assignable to type 'Session'
tl:dr
This is the error I'm getting in VS Code:
let session: AuthSession
Type 'Session | null' is not assignable to type 'Session'.
Type 'null' is not assignable to type 'Session'.ts(2322)
...
1
vote
0
answers
55
views
React Native Expo Facebook Auth with Supabase and react-native-fbsdk-next: Nonces Mismatch
I'm trying to implement Facebook authentication in a React Native Expo app using Supabase and react-native-fbsdk-next. I'm currently following the Google auth implementation guide provided by Supabase ...
1
vote
0
answers
76
views
Database update functionality works locally but doesnt on vercel deployement. This bug only happens in the Car Page
I have a website about cars. The tech stack is typescript, preact, astro, vercel, and supabase.
The current logic is if there are values for attributes like price, range, etc in the database then the ...
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/...
1
vote
1
answer
1k
views
"No storage option exists to persist the session" error when using Supabase and Zustand in a Next.js application with Clerk.dev authentication?
I have set up a Next.js application with authentication handled by Clerk.dev and data storage managed by Supabase. I am also using Zustand for state management. However, I am encountering an error ...
1
vote
0
answers
48
views
I am fetching token count from users table in supabase but does not appear straight away in the navbar when i login only after refreshing the page
import HomePage from '../HomePage/HomePage';
import LandingPage from '../LandingPage/LandingPage';
import AuthPage from '../AuthPage/AuthPage';
import MyAccountPage from '../MyAccountPage/...
1
vote
2
answers
710
views
Supabase connection returning undefined
I have a Vercel deployed Remix project with Supabase on the backend, Postgresql and using Prisma as the ORM. I have set up connection pooling as well as a direct connection to Supabase, but anytime I ...
1
vote
1
answer
373
views
Problem with Select Query using NestJs and Supabase
I'm trying to simply retrieve entries from the 'colegios' table on a supabase using nestjs, but the const 'data' is empty, logging [] on the console.
This is my code:
App.service.ts:
async ...
1
vote
0
answers
702
views
Prisma db seed not working on a remote supabase instance
I am working on a Nextjs project and would like to build a preview environment on Vercel where I use supabase (remote postgres) for database.
I would like to run prisma db seed in the preview ...
1
vote
1
answer
575
views
Nextjs - update another component when delete item from database (supabase)
I have a problem with update my parent component when I try delete item from database.
I create simply get items from my database:
const filter = useFilter((query) => query.eq("createDate"...
1
vote
1
answer
200
views
Trouble saving text to the Supabase Database on onChange in a form
I'm working on something that uses onChange saving (like auto saving on Gmail or docs on Google Docs) and I would like to save text from on onChange. I can do it with just displaying text from the ...
0
votes
1
answer
115
views
Typescript type error - Type 'string[]' is not assignable to type 'string'
I'm working on a Next.js project. I use Typescript and .tsx files. I use Supabase as db.
I'm unable to build the project in Vercel even if everything works perfectly on localhost.
The error I get is : ...
0
votes
1
answer
1k
views
Invalid `prisma.dayEvent.create()` invocation: Null constraint violation on the fields: (`id`)
When I'm trying to create event in calendar this error throws:
Invalid `prisma.dayEvent.create()` invocation:
Null constraint violation on the fields: (`id`)
Which is weird cause id have default() ...
0
votes
2
answers
245
views
Navigate to a URL when auth completed succesfully
I am currently developing a project for learning purposes, using Angular16 and Supabase as the backend. I have succesfully managed to sign in users with Github, Google and email (technically it does ...