storage icon indicating copy to clipboard operation
storage copied to clipboard

@vercel/postgres is not compatible with supabse and neon when connecting urls using sql apis

Open GmavionR opened this issue 1 year ago • 2 comments

@vercel/postgres is not compatible with supabse and neon when connecting urls using sql apis

If the database is supabse, but the underlying link uses neon directly

https://github.com/neondatabase/serverless/issues/122

GmavionR avatar Nov 24 '24 08:11 GmavionR

I think I ran into the same issue when trying to follow the Nextjs tutorial, chapter 7. I had setup a supabase on chapter 6 on Vercel, but when trying to use the sql imported from @vercel/postgres it wasn't working, I had to use db and initiate a client.

Next's tutorial for reference: https://nextjs.org/learn/dashboard-app/fetching-data

rogeriomoura avatar Dec 02 '24 00:12 rogeriomoura

I think I ran into the same issue when trying to follow the Nextjs tutorial, chapter 7. I had setup a supabase on chapter 6 on Vercel, but when trying to use the sql imported from @vercel/postgres it wasn't working, I had to use db and initiate a client.

Next's tutorial for reference: https://nextjs.org/learn/dashboard-app/fetching-data

This worked for Chapter 7.

In data.ts file:

import { db } from "@vercel/postgres";

const client = await db.connect();

And then in the same file, replace sql with client.sql everywhere.

Example:

const data = await client.sql<Revenue>`SELECT * FROM revenue`;

geekysaurabh001 avatar Jan 01 '25 07:01 geekysaurabh001