ServerMiddleware & Lifecycle
Runbook
Troubleshooting common middleware and request-context issues.
Symptom: prisma missing in handlers
- Cause:
tenantMiddlewaredid not run or failed (missingx-tenant-idor invalid API key). - Action: Check the request headers and server logs for
Missing org info/API key. VerifyorgConnectionexists for the org slug.
Symptom: Unauthorized errors for valid users
- Cause:
sessionMiddlewarefailed to resolve session (cookie not sent or auth service down). - Action: Inspect the session cookie, confirm
auth.apiconnectivity usingauthClienthealth checks.
Symptom: Lifecycle hooks not running
- Cause:
lifecycleMiddlewarewas short-circuited or an earlier middleware threw an error. - Action: Reproduce with
curl -vand check middleware order inroutes/index.ts.