next-learn
next-learn copied to clipboard
Chapter 7: Unable to fetch revenue data
⨯ Error: Failed to fetch revenue data.
at fetchRevenue (./app/lib/data.ts:30:15)
at async Page (./app/dashboard/page.tsx:15:21)
digest: "867752762"
29 | } catch (error) {
30 | console.error('Database Error:', error);
> 31 | throw new Error('Failed to fetch revenue data.');
| ^
32 | }
33 | }```
Anybody else facing the same issue?
What could be the possible fixes!
Database Error: NeonDbError: Error connecting to database: fetch failed
at execute (webpack-internal:///(rsc)/./node_modules/@neondatabase/serverless/index.js:4689:21)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async fetchRevenue (webpack-internal:///(rsc)/./app/lib/data.ts:25:22)
at async Page (webpack-internal:///(rsc)/./app/dashboard/page.tsx:15:21) {
code: null,
}```
database credentials are correct; unable to figure out why it is throwing the error
Database Error: Error: Database connection string format for neon()
should be: postgresql://user:[email protected]/dbname?option=value
at neon (webpack-internal:///(rsc)/./node_modules/@neondatabase/serverless/index.js:1515:54)
at VercelPool.sql (webpack-internal:///(rsc)/./node_modules/@vercel/postgres/dist/chunk-VGUHM5WG.js:154:80)
at Object.apply (webpack-internal:///(rsc)/./node_modules/@vercel/postgres/dist/chunk-VGUHM5WG.js:224:19)
at fetchRevenue (webpack-internal:///(rsc)/./app/lib/data.ts:29:77)
at Page (webpack-internal:///(rsc)/./app/dashboard/page.tsx:15:86)
I also have this issue ,but in the hosted url it works fine
the problem is in the local development,I tried to setup according to this : https://vercel.com/docs/storage/vercel-postgres/quickstart but still not working in the local development
is this not supposed work in our local?
is this not supposed work in our local?
No ,it should work in local as well,But i don't know why it does not work in locally.so i thought to build a local mysql database and continue the lesson ,If you familiar with postgres try that as well
try running vercel dev instead of npm run dev
that did the magic for me https://github.com/orgs/vercel/discussions/2350#discussioncomment-5850746
I am having the same issue and running vercel dev
does not work. I have updated all of the code from the Github repo for this course under "final-example." Still same issue. I can not get past Chapter 7 because I receive a catch error
`} catch (error) { 81 | console.error("Database Error:", error);
82 | throw new Error("Failed to fetch card data."); | ^ 83 | } 84 | }`
Everytime I try to fetch any of the data for the dashboard overview (revenue, invoices, and cards).