Commit 413d653
fix: add request ID tracking for production debugging
No request correlation existed — if a user reported "I got a 500 at
3:15pm", ops could not find that specific request in logs or Sentry.
Adds Hono's built-in requestId() middleware which:
- Generates a UUID per request (or respects incoming X-Request-Id)
- Sets X-Request-Id response header on all responses
- Available via c.get("requestId") throughout the middleware chain
Integration points:
- Global error handler: logs requestId, includes it in error JSON response
- Sentry middleware: tags every scope with request_id for event correlation
- Error responses now include requestId so clients can quote it in reports
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 2a9b9d2 commit 413d653
2 files changed
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
95 | 100 | | |
96 | 101 | | |
97 | 102 | | |
| |||
193 | 198 | | |
194 | 199 | | |
195 | 200 | | |
| 201 | + | |
196 | 202 | | |
| 203 | + | |
197 | 204 | | |
198 | 205 | | |
199 | 206 | | |
200 | 207 | | |
201 | 208 | | |
202 | | - | |
| 209 | + | |
203 | 210 | | |
204 | 211 | | |
205 | 212 | | |
| |||
208 | 215 | | |
209 | 216 | | |
210 | 217 | | |
| 218 | + | |
211 | 219 | | |
212 | 220 | | |
213 | 221 | | |
214 | | - | |
| 222 | + | |
215 | 223 | | |
216 | 224 | | |
217 | 225 | | |
218 | 226 | | |
| 227 | + | |
219 | 228 | | |
220 | 229 | | |
221 | 230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
0 commit comments