next-learn icon indicating copy to clipboard operation
next-learn copied to clipboard

Chapter 7: Unable to fetch revenue data

Open bhaskrr opened this issue 11 months ago • 9 comments

 ⨯ 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!

bhaskrr avatar Mar 22 '24 19:03 bhaskrr

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

bhaskrr avatar Mar 22 '24 19:03 bhaskrr

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)

vignxs avatar Mar 23 '24 04:03 vignxs

I also have this issue ,but in the hosted url it works fine image

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

krishanthan4 avatar Mar 24 '24 10:03 krishanthan4

is this not supposed work in our local?

vignxs avatar Mar 26 '24 16:03 vignxs

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

krishanthan4 avatar Mar 27 '24 03:03 krishanthan4

try running vercel dev instead of npm run dev

that did the magic for me https://github.com/orgs/vercel/discussions/2350#discussioncomment-5850746

vignxs avatar Mar 30 '24 09:03 vignxs

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).

evanmarshall-dev avatar Aug 27 '24 02:08 evanmarshall-dev