vercel / vercel/next-learn

Error when trying to fetchInvoiceById

Open
#505 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
4.8k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

I've been working through learning next dashboard course and at around chapter 13, I'm getting an error and can't resolve when clicking on editing an invoice.

The error is:

 app/lib/data.ts (176:10) @ fetchInvoiceById
 ⨯ Error: Failed to fetch invoice.
    at fetchInvoiceById (./app/lib/data.ts:159:15)
    at async Promise.all (index 0)
    at async Page (./app/dashboard/invoices/[id]/edit/page.tsx:16:34)
digest: "2772198818"
  174 |   } catch (error) {
  175 |     console.error('Database Error:', error);
> 176 |     throw new Error('Failed to fetch invoice.');
      |          ^
  177 |   }
  178 | }
  179 |

Hope you can help!
Cheers.

Link to location in docs
Repo link

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review app/lib/data.ts, especially fetchInvoiceById, and app/dashboard/invoices/[id]/edit/page.tsx; reproduce the edit-invoice action from chapter 13. Done when the edit page loads the selected invoice without the fetch error.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, typescript
Domain
full-stack
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.