Troubleshooting
Find the cause of common Folkways problems by symptom, from failed connections to missing messages, duplicates and memory use.
Start from what you see. Most problems come down to the token, the topic rule or where a subscription starts. The
error's codeName (in the JavaScript SDK, err.codeName) is the fastest clue; Error codes
lists them all.
The app can't connect
TransportUnavailable, or no answer at all: check the Realtime URL against the segment's Connect tab. A proxy that blocks WebSockets is fine: the SDK falls back to long-polling, unless the segment has HTTP turned off.AuthInvalid: the token's key ID isn't a signing key of this segment, the private key isn't that key's pair, the segment ID is wrong (a staging token sent to production, say), or the token lives longer than 15 minutes.AuthExpiredstraight away: the backend's clock is off; tokens allow 30 seconds of skew.Suspended: the segment is turned off in its settings, or the workspace's package isn't active.- Your token endpoint fails: the SDK treats any non-2xx answer as "not signed in". Call the endpoint yourself while
signed in and check it returns
{ "token": "…" }.
A publish or subscribe gets Forbidden
Forbidden means one of three things, and deliberately doesn't say which:
- No topic rule matches the topic. Rules match by pattern, from the top:
rooms/*doesn't matchrooms/42/chat. - The token doesn't grant the op on that topic: check
capabilitiesin your token endpoint, and that the op fits the event type (setfor KV,signalfor signals). - The topic is members-only and the user has no member entry, or one without that op.
ClassMismatch instead means the rule doesn't allow that event type, or doesn't list that event name.
A subscriber receives nothing
- It subscribed after the event was published. The default start is "only new events". Wait for
sub.readybefore publishing, or start from{ last: 20 }or a saved cursor. - Publisher and subscriber are on different topics or segments. Compare the topic names exactly, and the segment in each token.
- A
typesoreventsfilter on the subscription leaves the event out. - The handler throws. Errors in your handler are reported on the subscription's
errorevent; listen to it.
Messages are missing after a reconnect
The subscription reports a gap first when history is gone: expired (older than retention, or over the byte cap)
or epoch-lost (the service lost the topic's recent history). Listen for gap and fetch the missing range from your
backend. See Delivery and ordering.
Messages arrive twice
- After a reconnect you may see the last event again: drop events whose cursor isn't after the one you saved, or whose uid you have already handled.
- A publish retried without the same idempotency key, or more than 10 minutes later, is a new event. The SDK reuses the key on its own retries; reuse your own when you retry.
- Two tabs of one user each receive the event: that's expected, they're two connections.
The connection keeps reconnecting
Replaced: the user is over the segment's connections per user limit, and each new tab closes the oldest. Raise the limit or show "signed in elsewhere"; don't reconnect automatically.AuthRevoked: your backend kicked the user or revoked the token. The SDK stops; give it a new token deliberately.RateLimitedon connect: too many new connections per minute, or too many failed sign-ins from one address. The SDK waits as asked.- Timeouts every 90 seconds: something between the app and Folkways drops idle sockets, or pings are blocked.
KV values are missing or stale
- The value's TTL ran out, or someone deleted it.
- The key defaults to the publisher's identity, so two users writing
scorewithout akeywrite two values. - In the JavaScript SDK, open the view (
values(…).open()) before subscribing, or it misses the snapshot.
Typing indicators stick or flicker
A signal lives for its TTL (5 seconds by default). Resend it a little more often than its TTL while the user types: for example every 2 seconds with a 3-second TTL. Longer gaps flicker; a long TTL sticks after the user stops.
Presence is empty
- The topic's rule doesn't have presence on.
- The reader's token lacks the
presenceop on the topic, or on$online/…. - The topic is members-only: client tokens can't read its presence.
- The people you expect are connected over HTTP long-polling, or with invisible tokens.
QuotaExceeded, RateLimited or PayloadTooLarge
QuotaExceededon publish: a monthly allowance or a segment cap is used up; check Usage in the Console. On subscribe: over 1,000 subscriptions on one connection, or the topic limit.RateLimited: waitretryAfterMsand send again; slow down or pick another rate preset.PayloadTooLarge: measure the encoded bytes, not the string length; the limit is 60 KiB or lower.
The app uses too much memory
In the JavaScript SDK, dispose views you no longer show, unsubscribe from topics you've left, and check
client.diagnostics(). QueueFull means a budget is full: see Resource management.
Asking for help
Include the SDK version, the transport, the time window in UTC, the operation, the topic pattern, the error code and its retry delay. Never include private keys, tokens or personal data.