Troubleshooting
Where to look when the backend misbehaves: how to find every log line of one request, which debug namespaces show what, and, by symptom, what the code does that produces it and where the full explanation lives. Each row states the behaviour; the reasons and the edge cases are on the linked page. Terms are in the Glossary.
Failure & degradation · Process lifecycle · Request lifecycle · API error variants · Deployment
Finding one request in the logs
middleware.logger takes the x-correlation-id request header when it is a UUID and otherwise
generates one; the id is bound to every line written through the request’s logger. The backend
does not return the id in a response header and does not send it to Repliers or FUB, so to find a
request later, send your own UUID in x-correlation-id.
| Line | Written by | Level | Carries correlationId | When |
|---|---|---|---|---|
Request: <METHOD> <url> | middleware.pino | info | yes, plus the serialized request | every request that reaches the logger middlewares |
any line logged through the logger token during the request, for example Repliers call without x-repliers-forwarded-for | the child logger | as written | yes, plus url, endpoint, body, referer, x-forwarded-for | while the request runs |
{ err } with the error’s message | koa-pino-logger | error | yes | a value thrown below the logger middlewares, 4xx included |
logger.error(err) of the error handler | logger.global (it runs outside the request’s scope) | error | no | the same thrown value, a second time |
Response: <status> <ms> <METHOD> <url> | middleware.pino | info | yes | response below 500 |
request errored with failed with status code <status> | middleware.pino | info | yes | response of 500 or more |
| worker lines | logger.global, to which src/worker.ts adds { correlationId } with setBindings for every message | as written | every id bound so far: pino appends each binding and skips undefined, so a line carries one correlationId key per webhook message processed so far, the current one last; a people.upsert message has no header and adds nothing, so its lines carry the earlier messages’ ids | in the worker process, from the first webhook message until the process ends |
the error that StreamWorker.process catches | console.error | stderr | no | worker handler failure |
The webhook handler copies the request’s id into the header of every message it publishes
(src/routes/webhooks/boss.ts, src/services/boss/webhook.ts), so a search for that id finds the
web-process lines and the worker lines of that message, and also every later worker line of the same
process, because the binding is never removed. Within one worker line of a webhook message, that message’s id is
the last correlationId key (JSON.parse keeps the last of duplicate keys). Observed with the
installed pino 10.3.1: setBindings with a, then b, then undefined gives
"correlationId":"a","correlationId":"b" on every following line.
Lines of one failed request (executed 2026-10-20, pino-pretty output reduced to message and the
binding; stand-ins: the correlation id 11111111-2222-4333-8444-555555555555 was sent by the
probe, the Repliers base URL pointed at a local server that never answers):
INFO Request: GET /api/locations correlationId: 1111…5555
INFO Repliers call without x-repliers-forwarded-for correlationId: 1111…5555 reason: "proxy-disabled"
ERROR Repliers API error: undefined correlationId: 1111…5555
ERROR Repliers API error: undefined (no correlationId)
INFO request errored correlationId: 1111…5555The reasons in the second line, and when each applies, are on Client IP forwarding: diagnosing a missing header.
Debug namespaces
DEBUG=repliers:* turns on the debug output (stderr, not the JSON log). Narrow it to the
namespace you need; some print whole request objects.
| Namespace | Prints | Source |
|---|---|---|
repliers:services:repliers | the outbound Repliers request options, the status and the first 1500 characters of each response, the upstream response of a failed call | src/services/repliers/base.ts |
repliers:lib:decorators/cached | NS: <namespace>, ttl: <ms> after each cache miss whose method resolved | src/lib/decorators/cached.ts |
repliers:scrubber:listings | whether each listing is scrubbed as guest or as user | src/services/scrubber/listings.ts |
repliers:services:eventsCollection | success or failure of each CRM event and note | src/services/eventsCollection/eventsCollection.ts |
repliers:services:autosuggest | the autosuggest requests and the failure of the MLS-number branch | src/services/autosuggest.ts |
repliers:services:boss:webhook | the worker’s webhook processing steps and their errors | src/services/boss/webhook.ts |
Symptoms
Startup
| Symptom | What the code does | Check | Deep dive |
|---|---|---|---|
AssertionError such as No REPLIERS_API_KEY env variable, and the process exits | asserts in src/config.ts at import, before the preset is merged | the variable is in the process environment, not only in a preset | Startup prerequisites |
eventsCollection URLs are relative but SETTINGS_EVENTS_COLLECTOR_URL_HOST is not set | URL assembly after the merge throws | set the host, or make the templates absolute | URL assembly |
ENOENT for a .pem path, web process only | the route modules read the JWT key files at import | the path is relative to the backend root, or put the PEM text in the variable | Issuing |
Fatal with origin: "unhandledRejection" and a NATS ConnectionError; the web process exits | with NATS_ENABLED=true the web process connects at startup and nothing handles a refused connection | NATS is reachable from the web process, or NATS_ENABLED is off | What stops a step |
Worker logs Establishing NATS connection, attempt <n> failed again and again | the retry re-awaits one failed connection promise; it never reconnects, and the worker exits after the last retry | fix NATS, then restart the worker | Process lifecycle |
Worker ends right after NATS is disabled, not starting worker | expected with NATS_ENABLED unset: no consume loop runs | run the worker only with NATS | Deployment |
Web process exits after Checking for old/stale webhooks | a FUB error during installHooks rejects the top-level await | FUB credentials, BOSS_SYSTEM, BOSS_SYSTEM_KEY, reachability of FUB | Webhook installation |
Authentication
| Symptom | What the code does | Check | Deep dive |
|---|---|---|---|
401 Authentication Error on a strict route | no Authorization header | the header is sent as Bearer <token> | Verifying |
| A signed-in user gets guest results on a guest-allowed route | a header that is not Bearer <token> is dropped silently by the passthrough middleware, so the request is a guest | the header format | Authentication gotchas |
401 Authentication Error: jwt expired, jwt issuer invalid, invalid signature | koa-jwt verification | token lifetime (JWT_EXPIRE, AGENT_JWT_EXPIRE), JWT_ISSUER and the key pair of the issuing deployment | Issuing |
401 Token revoked | the token has no string jti, or its jti is in the blocklist after a logout or refresh | sign in again; use the token returned by refresh | Revocation |
| A logged-out token still works, or a valid OTP code is rejected, only sometimes | without REDIS_KEYV_ENABLE=true the blocklist and the OTP store are per process | Redis-backed Keyv when more than one web process runs | Revocation |
403 with Retry-After on login | OTP resend cooldown, also after a failed message send | wait the given seconds | Side effects and failures |
| 500 when a token is issued | the role lookup queries the acl table; a database error fails the request | database reachable, or APP_DISABLE_PERSISTENCE=true | Issuing |
403 Insufficient privileges | the token’s role is not in the route’s list; with persistence off an OTP token has no role | the acl row of the e-mail | Agents and roles |
| Every authenticated request waits (no timeout is set) | with REDIS_KEYV_ENABLE=true and Redis unreachable the revocation lookup waits for a connection | Redis reachability | Failure outcomes |
Search and upstream errors
| Symptom | What the code does | Check | Deep dive |
|---|---|---|---|
400 with a Joi message in userMessage | request validation, first error only | the parameter named in the message | Validation |
4xx Repliers API error: <status> with an info object | the Repliers status is relayed and its body is in info | info says what Repliers rejected; a 401 or 403 there concerns the backend’s Repliers key, not the user | Error variants |
500 undefined - Repliers API error: undefined - <path> | Repliers did not answer within REPLIERS_TIMEOUT or the connection failed | upstream reachability; how long the call waited | Failure outcomes |
500 Internal Server Error from an autosuggest route | Mapbox or Google did not answer; the client’s .catch throws a TypeError | provider reachability, MAPBOX_TIMEOUT / GOOGLE_MAPS_TIMEOUT_MS | Failure outcomes |
| Whole autosuggest request fails while only one provider is down | the branches are joined with Promise.all; only the MLS-number branch is caught | which upstream failed, from the error line | Branch register |
| Slow responses without any error | outbound Repliers calls wait in the process-wide throttle; the wait is not logged | REPLIERS_API_LIMIT and REPLIERS_API_INTERVAL_MS against the traffic | Retry layers |
Listings carry only status, permissions, address, duplicates, boardId | a search without fields is sent upstream with just those five | send the fields you need | Scrubbing: ordering |
| A listing never appears in results | the restricted list (not:mlsNumber), the allowed-status policy, and the forced displayInternetEntireListing=Y narrow every search | settings.restrictedListings, allowedListingsStandardStatuses | Restricted listings, policy |
| 410 for a listing detail | validateAvailability refuses a restricted, not-entirely-displayable or hidden-status listing | APP_HIDE_UNAVAILABLE_LISTINGS_* settings | Detail, similar & history |
Visibility
| Symptom | What the code does | Check | Deep dive |
|---|---|---|---|
Values read !scrubbed! | guest masking on displayPublic=N; strings and numbers get the same sentinel | whether the request carried a token | Who gets scrubbed |
| A guest sees data that should be masked | the scrubber acts only on listings whose boardId is in SETTINGS_SCRUBBING_BOARDIDS; SETTINGS_SCRUBBING_FORCE_DISPLAY_PUBLIC_YES turns masking off | the endpoint’s row and the board list | Visibility register |
A signed-in user sees a masked address or no map | displayAddressOnInternet=N and displayOnMap=N apply to every caller | the listing’s permissions | Permission fields |
Delayed or missing sync
| Symptom | What the code does | Check | Deep dive |
|---|---|---|---|
| A FUB change never reaches the Repliers client | the web process stores a job row and publishes it; only the worker writes the client | the row’s status in webhooks (webhooks) or people_sync (agent sync): PENDING, SUCCESS or the error text | Outcomes |
Rows stay PENDING | NATS is disabled (DummyNats stores nothing), the worker is not running, or the publish failed after the insert; nothing re-publishes a row | NATS_ENABLED on both processes, the worker process | Worker handoffs |
Status {"error":"No tags found"} on every job | the person needs a tag from BOSS_WEBHOOK_CLIENT_TAGS_CSV; an empty value lets no one pass | the tag list | Variation |
| The same job fails and is retried over and over | every thrown error is naked and redelivered by the server | the status text; the server’s consumer limits | The NATS worker |
| No webhook requests arrive | webhooks are registered only by a web process with BOSS_WEBHOOK_ENABLED=true; each start deletes what FUB lists first, and a signal deletes the process’s own ids | the startup log lines of installHooks, FUB’s webhook list | Webhook installation |
| An engagement event is missing in FUB | BOSS_ENABLED=false, a guest on a route without allowIncognito, a selector that returns null, or a CRM failure that reaches only the debug log | DEBUG=repliers:services:eventsCollection; the route’s row | Engagement reporting |
Stale data
| Symptom | What the code does | Check | Deep dive |
|---|---|---|---|
| A count, location list, building or statistic does not change upstream changes | @cached results live until their TTL; only the featured list is ever cleared by code | the namespace’s TTL variable | Cache state |
| Two identical requests give different results | without Redis each process has its own caches | REDIS_KEYV_ENABLE | Keyv stores |
| The browser keeps an old answer | sendCached sets Cache-Control: private, max-age=<remaining seconds> | the response header | Cache-Control |
| A featured list is stale | cleared on favorite add and delete through this backend; changes made elsewhere wait for the TTL | CACHE_FEATURED_LISTINGS_TTL | Cache state |
lastUpdatedOn does not match any listing (Not in OSS) | the value is synthetic: now minus a random 2 to 5 minutes, cached | nothing to fix upstream | Cache state |
| A configuration change has no effect | configuration is read once at startup; a preset key beats the same environment variable | restart; the preset | Configuration resolution |
Verified against portal-backend 997ae3e, 2026-10-20.