Problem connecting to Supabase during App Router Tutorial

I’m following the App Router tutorial, and am on Chapter 7, which is for fetching data. I had set up a Supabase DB following the tutorial. I am trying to run the dashboard where it will present the RevenueChart component, but I’m receiving an error that there was an error connecting to the database. This shows up during this line

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

in app/lib/data.ts file. I’ve followed the tutorial so far, uploaded all the environment variables to an “.env” file (which I’ve tried as process.env and .env), but it for some reason won’t connect.

Here is the specific error

“[ Server ] Error: Error connecting to database: fetch failed”

Any idea why I cannot connect to Supabase following this tutorial, and how I can fix it?

Did you run into any errors or warnings when creating and seeding the database in the previous chapter?

No, I didn’t. That is partially why I’m confused by the tutorial.

I did go back and create a new Neon database instead, and that has been working.

Thanks for letting me know. I’m glad you found a workaround. I wasn’t able to replicate the error in my own test project, but I’ll be on the lookout for similar reports.

1 Like