Propagate correlation IDs across API requests#113
Merged
Abd-Standard merged 2 commits intoJun 20, 2026
Merged
Conversation
- add resolveCorrelationId() — honours incoming X-Correlation-Id header, falls back to a new UUID when absent - echo X-Correlation-Id back on every response - expose X-Correlation-Id in Access-Control-Allow-Headers for CORS - include correlationId in every logger call alongside requestId - add events-server tests covering generation, echo, and 404 flow
Collaborator
|
please resolve conflicts |
…routes Resolved conflict in events-server.ts: layered correlation ID propagation (resolveCorrelationId, X-Correlation-Id header) onto the upstream's refactored flat-routing structure which added webhook signature verification and user preference endpoints.
8109be3 to
3ce6c2f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #95
What
Every API request now carries a correlation ID that is logged server-side and echoed back to the caller, making it easy to trace a request end-to-end across logs.
Changes
utils/request-id.tsresolveCorrelationId(header)— honours an incomingX-Correlation-Idheader if present, otherwise generates a fresh UUIDapi/events-server.tsX-Correlation-Idrequest header on every requestX-Correlation-Idon every response (including 4xx/5xx)X-Correlation-IdtoAccess-Control-Allow-Headersso browser clients can send itcorrelationIdinto everyloggercall alongside the existingrequestIdtests/events-server.test.ts(new)x-request-idandx-correlation-idpresent and distinctBackward compatibility
No existing behaviour changes —
X-Request-Idis still set, all endpoints work identically. Callers that don't sendX-Correlation-Idget one generated for them.