Selegic CRM Docs
ServerMiddleware & Lifecycle

Runbook

Troubleshooting common middleware and request-context issues.

Symptom: prisma missing in handlers

  • Cause: tenantMiddleware did not run or failed (missing x-tenant-id or invalid API key).
  • Action: Check the request headers and server logs for Missing org info/API key. Verify orgConnection exists for the org slug.

Symptom: Unauthorized errors for valid users

  • Cause: sessionMiddleware failed to resolve session (cookie not sent or auth service down).
  • Action: Inspect the session cookie, confirm auth.api connectivity using authClient health checks.

Symptom: Lifecycle hooks not running

  • Cause: lifecycleMiddleware was short-circuited or an earlier middleware threw an error.
  • Action: Reproduce with curl -v and check middleware order in routes/index.ts.

On this page