Return a request ID with every API response
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 72/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- nodejs, typescript
- Domain
- backend, observability
Research direction
Start with the middleware order in apps/api/src/app.ts, then read apps/api/src/middleware/error.ts and apps/api/src/services/errorTracker.ts to see where errors are logged and tracked. Add a request-ID middleware that accepts a valid incoming X-Request-Id (up to 64 letters, digits or dashes), otherwise generates a UUID, and sets the response header. Done means every response carries the header, malformed input is replaced, 5xx JSON and the tracker record include the ID, and a test covers both cases, with a note in docs/MONITORING.md.
Written by the indexing model from the issue text.
Description
Difficulty: Beginner to Intermediate · Estimated size: half a day
Context
apps/api/src/middleware/error.ts and the monitoring code already deal with errors. When a person reports a problem, it is hard to match it with the server log line.
Problem or goal
Give every request an ID that is logged, returned in an X-Request-Id header and included in error responses.
Suggested approach
- Add a middleware early in
apps/api/src/app.tsthat accepts a safe incomingX-Request-Id(max 64 characters of letters, numbers and dashes) or generates a UUID, stores it onreq, and sets the response header. - Include it in the JSON of 5xx errors and in the error tracker record.
- Expose the header to the browser via CORS only if needed (check
Access-Control-Expose-Headers).
Where to look
apps/api/src/app.tsapps/api/src/middleware/error.tsapps/api/src/services/errorTracker.ts
Acceptance criteria
- Every response has the header.
- A malformed incoming ID is replaced, never echoed.
- A test checks both cases.
docs/MONITORING.mdmentions it.
How to work on it
- Comment here to claim it, so two people do not do the same work.
- Fork the repo and branch from
main(feat/short-nameorfix/short-name). Setup steps are in docs/DEVELOPMENT.md. - Keep the change focused and add tests for backend logic.
- Run
npm run typecheck,npm testandnpm run lintandnpm run formatbefore opening the pull request. - Use a Conventional Commits title (for example
feat(web): add bookmarks). More in CONTRIBUTING.md.
Stuck? Ask in this issue. Questions are welcome.
Generated by Claude Code
- Dominant language
- TypeScript
- Stars
- 6
- Forks
- 6
- Avg merge
- 1h 59m
- Merged PRs (30d)
- 59
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Haseeb-MernStack/commune
-
enhancement good first issue web
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Haseeb-MernStack/commune#141 ·
Maintainers usually reply within 1 day
-
documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Haseeb-MernStack/commune#138 ·
Maintainers usually reply within 1 day
-
api good first issue tests
Difficulty 2/5 Half a day Newbie friendliness 72/100
Haseeb-MernStack/commune#132 ·
Maintainers usually reply within 1 day
-
ci good first issue tests
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Haseeb-MernStack/commune#133 ·
Maintainers usually reply within 1 day
-
accessibility good first issue web
Difficulty 2/5 Half a day Newbie friendliness 74/100
Haseeb-MernStack/commune#117 ·
Maintainers usually reply within 1 day
All issues in Haseeb-MernStack/commune
Similar issues
-
[UI] Guard webApis against undefined window in SSR environmentsPossibly taken @madhavzanwar claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
headroomlabs-ai/headroom#4992 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
paperclipai/paperclip#22575 ·
Maintainers usually reply within 1 day
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 82/100
lingdojo/kana-dojo#34502 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
bug frontend good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
nikhilb2/simple_invoicing#935 ·