You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
^
NeonDbError: Error connecting to database: fetch failed
at execute (file:///project/workspace/node_modules/@neondatabase/serverless/index.mjs:1548:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///project/workspace/index.js:9:14 {
severity: undefined,
code: undefined,
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: undefined,
line: undefined,
routine: undefined,
sourceError: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11372:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async execute (file:///project/workspace/node_modules/@neondatabase/serverless/index.mjs:1547:21)
at async file:///project/workspace/index.js:9:14 {
cause: Error: getaddrinfo ENOTFOUND api.pooler.supabase.com
at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'api.pooler.supabase.com'
}
}
}
The reason for the error is that we passed supabse's database url when using neon, which caused the query to error.
Why do you ask? Chapter 6 of the nextjs Learning demo mentions creating a database, but does not specify whether you should create neon or supabse.
Although in theory @vercel/postgres blocks the difference between low-level neon and virtual.
However, there is a bug with @vercel/postgres that actually uses neon internally when sql is used directly in the following code, even though my.env configuration is configured with the supabase url
import { sql } from '@vercel/postgres';
export async function fetchLatestInvoices() {
try {
const data = await sql<LatestInvoiceRaw>`
SELECT invoices.amount, customers.name, customers.image_url, customers.email, invoices.id
FROM invoices
JOIN customers ON invoices.customer_id = customers.id
ORDER BY invoices.date DESC
LIMIT 5`;
const latestInvoices = data.rows.map((invoice) => ({
...invoice,
amount: formatCurrency(invoice.amount),
}));
return latestInvoices;
} catch (error) {
console.error('Database Error:', error);
throw error; throw new Error('Failed to fetch the latest invoices.');
}
Expected result
neon gives the correct indication when linking to the supabse.com url
Actual result
Now it's an error
Environment
Logs, links
The text was updated successfully, but these errors were encountered:
@GmavionR can you point me to the Next.js learning demo you are using?
@vercel/postgres is a wrapper around the Neon serverless driver. I believe it is solely intended for use with Neon. I would not expect it to support connecting to a Supabase database.
Steps to reproduce
Start by creating a supabase pg storage in vercel, note supabase instead of neon. Then use the following code to test, will report an error.
The reason for the error is that we passed supabse's database url when using neon, which caused the query to error.
Why do you ask? Chapter 6 of the nextjs Learning demo mentions creating a database, but does not specify whether you should create neon or supabse.
Although in theory @vercel/postgres blocks the difference between low-level neon and virtual.
However, there is a bug with @vercel/postgres that actually uses neon internally when sql is used directly in the following code, even though my.env configuration is configured with the supabase url
Expected result
neon gives the correct indication when linking to the supabse.com url
Actual result
Now it's an error
Environment
Logs, links
The text was updated successfully, but these errors were encountered: