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
Log unexpected API errors on the server without leaking data #37
When an HTTP business operation throws something unexpected, errorResponse in packages/core/http.ts returns { error: "INTERNAL_ERROR" } with status 500 and logs nothing. On a deployment that makes failures in /api/crm invisible.
src/app/api/integrations/cron/route.ts already logs in a safe structured form, for example console.error(JSON.stringify({ event, ... })), without SQL, message bodies or credentials.
Done when
Unexpected errors handled by errorResponse are logged once as a single JSON line with an event name, the error name and the operation if known.
The log never includes request bodies, SQL parameters, tokens or message content.
Expected domain errors (validation, conflicts, permission denials) are not logged as errors.
A test asserts the log call happens for an unexpected error and not for a validation error.
Activity