LaWalletdocs
Guides

Debugging

Diagnose runtime issues — structured logs, request tracing by reqId, slow queries, auth failures

Debugging

The web app emits structured Pino JSON logs with per-request correlation. This page is the quick reference; the full runbook lives in the repo at docs/DEBUGGING.md.

Verbose logging

LOG_LEVEL=debug LOG_PRETTY=true pnpm dev:web

Follow one request

Every response carries an x-request-id header. Filter the server logs to that single request:

pnpm dev:web 2>&1 | node scripts/logs.mjs --reqId=<id>

Other filters: --module=prisma, --span=nwc.pay_invoice, --minMs=100, --level=warn.

Slow queries

Prisma queries slower than SLOW_QUERY_THRESHOLD_MS (default 100ms) log at warn with the SQL and duration. Set 0 to disable.

Common auth failures

SymptomCause
401 "Invalid or expired JWT"Issuer (lawallet-nwc) / audience (lawallet-users) / secret mismatch — each worktree has its own JWT_SECRET
401 on NIP-98created_at skew, URL mismatch, or method casing
403 AUTHORIZATION_ERRORRole lacks the required permission
503 from /api/healthServer can't reach the database — check pnpm dev:env output

On this page