All Questions
337
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/...
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 ...
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/...
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 ...
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]{
...
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
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: ...
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
191
views
Run slow background process when certain conditions in Postgres data are met?
I'm using Postgres (via Supabase) and Node (via NextJS on Vercel).
I have a table report which has columns for an enum region, and generated_text which is content generated by AI.
create type region ...
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
2
answers
5k
views
Nexts.js 13 + Supabase > What's the proper way to create a user context
I'm building an app with Next.js 13 and Supabase for the backend, and I've been stuck on figuring out the best/proper way to go about creating a context/provider for the current logged in user.
The ...
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
1
answer
1k
views
Next JS + Supabase real time subscription subscribes with state "closed"
I am working on this helpdesk for a school project using Next JS and Supabase and got stuck on realtime chat between the operator and the client.
I subscribe to the table in useEffect hook and return ...
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 ...
4
votes
1
answer
6k
views
How to update the password of a Supabase user on a NextJs project?
I'm facing an issue updating a password for a supabase user on a BlitzJs (NextJs) project.
Basically, I have a reset password method that works perfectly. First I send an email with a reset link, that ...
3
votes
2
answers
4k
views
Cannot access env variables next.js [duplicate]
I'm creating an app with Next.js and Supabase. When I create the client in /utils/supabase-client.js, it throws the error that Error: supabaseUrl is required..
Here is my file:
import { createClient } ...
3
votes
2
answers
2k
views
Can't reach database server at `aws-0-us-east-1.pooler.supabase.com`:`5432`
Happy Monday! I've recently run into a weird issue and can't seem to figure out what would be causing it.
I have a NextJS project using Prisma and Supabase. When I run the app on my Windows desktop or ...
3
votes
1
answer
694
views
Best practice for integrating clerk with supabase
I came up with my custom react hook for handling supabase, I don't know if using this hook everywhere would be the best practice as I have to deal with isLoading every time when I use it.
import { ...
3
votes
1
answer
2k
views
NextJs + supabase not deploying supabaseUrl is required
i'm trying to deploy my project but i keep getting this error saying that supabaseUrl is required.
I'm getting this error
This is my supabaseClient.js
import { createClient } from "@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
4k
views
How to handle redirect from supabase signin?
I was hoping someone would show me how to handle redirect (to dashboard page) in supabase. Here below is a sample of my code (the issue is I would like to redirect to an account page after ...
3
votes
1
answer
733
views
How to make a boolean form input in supabase using nextjs server actions?
I am trying to make a form to submit data to supabase (with nextjs 13).
I can submit a string input. I am trying to add a boolean field.
I have commented out the 'published' fields in this form. If I ...
3
votes
0
answers
375
views
supabase "TypeError: fetch failed" using next.js
I am trying to make a request to nextjs route handler where I am using supabase database to retreive some rows from a particular database table. The table exist and it is already filled with rows. ...
3
votes
2
answers
470
views
Next Js with Supabase Failed to compile
I created a project with Next.js and Supabase, and everything was running smoothly. However, after adding a table and generating TypeScript Definitions from the PostgreSQL schema using Supabase CLI, I ...
3
votes
0
answers
1k
views
Next.js and Supabase: Method expects to have requestAsyncStorage
The issue:
In prod, Next.js throws that error message: Invariant: Method expects to have requestAsyncStorage, none available. This error message occurs only server components and also in prod (Deploy ...
3
votes
0
answers
485
views
User gets logged in automatically when resetting password
I'm trying to develop a password reset process with Next.js (13.4) and Supabase Auth.
Issue:
After the user clicks on the password reset link received via email, if they refresh the page, they ...
3
votes
0
answers
906
views
Authentication error Supabase and Prisma on Nextjs
This is the error message I’m getting when i run npx prisma db push
I’ve created a project, database and a table in Supabase
I also have the schema.prisma file and passing the DATABASE_URL from ...
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
249
views
Conditionally rendering UI based on cookies and supabase affects the rest of my program Next.js 13
I am trying to conditionally render an account button when a user is authenticated; render a login + sign-up button when the user is not authenticated as follows:
My DesktopBar.tsx file
import { ...
2
votes
6
answers
10k
views
Get supabase `user` server side in next.js
I am attempting to get the current logged in supabase user while server side.
I have attempted to use const user = supabase.auth.user(); but I always get a null response.
I have also attempted const ...
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
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
2
answers
1k
views
Handling Sign Up with Existing Email in Supabase
I'm working on a sign-up feature using Supabase and I want to provide feedback to the user if they try to sign up with an email that already exists in the system. However, I'm facing a challenge in ...
2
votes
2
answers
1k
views
Supabase with Next.js 13 App Router OAuth not logging in
Whenever I log in with
// twitch signin handler
const handleTwitchSignIn = async () => {
const { data, error } = await supabase.auth.signInWithOAuth({
provider: "twitch",
...
2
votes
1
answer
3k
views
How to query a NextJS route handler from a server component and get data from Supabase
Whenever I try to fetch data from my route handler from within a server component in NextJS, the query is made by the server, therefor the route handler returns this error : { error: 'JSON object ...
2
votes
1
answer
339
views
Implementing Distinct Sign In and Sign Up Views with @supabase/auth-ui-react
I'm working with @supabase/auth-ui-react, and I'm trying to implement different types of authentication views, specifically for Sign In and Sign Up. I've looked at the documentation, but I couldn't ...
2
votes
1
answer
491
views
Supabase Auth and Remix
Supabase offers a tutorial on how to implement auth with Remix and Supabase.
Part of the tutorial is focused on client-side authentication where it even exposes the env variables SUPABASE_URL and ...
2
votes
2
answers
2k
views
Get count and specify range in a supabase js query
Im making a recipe website with nextjs and supabase. I have an occasions table which has a foreign key to many recipes. I can easily query the occasions for all recipe in that occasion however I want ...
2
votes
1
answer
2k
views
TypeError: supabaseClient.auth.getSession is not a function. Error with NextJS and Supabse
I'm using supabase auth helper package to React and Next in my project. Immediately, when I start the page, I get an error message that says the following:
And it is that I am not calling that ...
2
votes
1
answer
728
views
Stripe webhook checkout.session items to Supabase
Im using next.js and Stripe webhooks to insert checkout sessions to Supabase that will create a customer's order history. I'm able to get the information about the whole order written to a table ...
2
votes
3
answers
4k
views
Fetching image from Supabase storage through database table returns undefined URL
I am building an app in Next.js, which fetches dynamic data from a Supabase table. The table (called product) has several data points (title, description, image). My table in Supabase looks like this:
...
2
votes
2
answers
3k
views
supabase download image bad request headers should have required property 'authorization'
im having trouble downloading an image from supabase. I get this errror
{
"statusCode": "400",
"error": "Bad Request",
"message": "headers should ...
2
votes
1
answer
700
views
Next.js server side props not loading in time
I'm using supabase and trying to load the user session on the server side. If you refresh the page, it catches there is a user but not on first load (e.g. like when coming from a magic link). How can ...
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
834
views
How do I get Supabase data cached in NextJs to update properly?
I am using Supabase with NextJs (app router) to create a web app. Most of the data that we are using is highly dynamic, so from what I can understand, there is no static rendering.
We have structured ...
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 ...