N
Neon3mo ago
xenial-black

Error: Error connecting to database: fetch failed (next.js)

My code: import { neon } from "@neondatabase/serverless"; async function getData() { if (!process.env.DATABASE_URL) { throw new Error("DATABASE_URL is not defined"); } const sql = neon(process.env.DATABASE_URL); console.log("Connecting to database with URL:", process.env.DATABASE_URL); const response = await sqlSELECT version(); return response[0].version; } export default async function Page() { const data = await getData(); return <>{data}</>; } Your Examples Link: https://github.com/neondatabase/examples/blob/main/with-nextjs-server-components/README.md I am just clone your Examples. Then when run your examples then this kind of error i face. How to solve this kind of error. Can help me anyone. I am new in NeonDB.
GitHub
examples/with-nextjs-server-components/README.md at main · neondat...
Examples and code snippets demonstrating common ways of integrating Neon with various frameworks and languages. - neondatabase/examples
No description
No description
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?