You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add top-level Fastify error handler that logs full stack on 500 #312
500 responses today go through Fastify's default error handler, which returns the error message in the response body but does not log the stack to stdout/pm2. During #309 (intermittent 500 on concurrent PUTs), we had to infer the thrown exception from the 91-byte response body because no stack trace was captured. That investigation took significantly longer than it needed to.
Fix
Register a fastify.setErrorHandler in src/server.js that:
Logs err.stack (plus request method/url/hostname) via request.log.error or console.error
Delegates response shape to the default behavior (or reproduces it) so existing API contracts don't change
Skips logging for expected FastifyError subclasses that carry their own statusCode (validation errors, etc.) to avoid noise
Impact
Every future 500 in production gets a real stack trace. Near-zero runtime cost.
Activity
Merge pull request #314 from JavaScriptSolidServer/issue-312-error-ha…
Add top-level Fastify error handler that logs full stack on 5xx (Java…