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?