Skip to content

Add request ID middleware#555

Merged
Jayy4rl merged 2 commits into
StellarYield:mainfrom
Martins-O:add-request-id-middleware
May 30, 2026
Merged

Add request ID middleware#555
Jayy4rl merged 2 commits into
StellarYield:mainfrom
Martins-O:add-request-id-middleware

Conversation

@Martins-O
Copy link
Copy Markdown
Contributor

Title: feat(backend): add request ID middleware
Description:
Adds a lightweight Express middleware that generates a UUID per request, creates a pino child logger scoped to that request, and sets the X-Request-ID response header.
Changes:

  • backend/src/api/middleware/requestId.ts — new middleware: generates crypto.randomUUID(), creates logger.child({ requestId }), sets X-Request-ID header, augments Express Request type with requestId and log properties
  • backend/src/app.ts — registers middleware after CORS, before all route handlers
  • backend/src/api/middleware/errors.ts — uses req.log (with fallback) so error logs include the request ID
    Branch name note: The checklist specifies issue--. This branch is add-request-id-middleware. If you want to rename it, I can help with git branch -m.
    Testing: Typecheck passes (tsc --noEmit clean). Pre-existing lint warnings in vaults.ts (2x unused err in catch blocks) are unrelated.

Closes #513

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@Martins-O Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Jayy4rl Jayy4rl merged commit 87eef5d into StellarYield:main May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add request ID middleware

2 participants