Loading...
Loading...
ALWAYS use when diagnosing Ably issues — messages not arriving, presence not updating, connection failures, auth errors (40101, 40142, 40160), channel lifecycle problems, push notification issues, Chat room issues, Spaces member/cursor issues, or any Ably error code. Provides Ably CLI commands to observe live traffic, inspect state, and simulate clients. Not for building new Ably integrations (use using-ably skill instead).
npx skill4agent add ably/agent-skills debugging-with-ably-cli@ably/clinpm install -g @ably/cliably --helpably <command> --helpMessages not arriving
├── Is anyone on the channel? → list channels with a prefix filter
├── Was anything published? → check channel history (2 min only without persistence)
├── Can I see messages live? → subscribe to the channel
├── Test round-trip → subscribe in background, publish from main terminal
└── Check channel lifecycle → subscribe to channel lifecycle logs, or inspect the channel in the dashboard
Presence not working
├── Who is actually present? → subscribe to presence on the channel
├── Simulate a client joining → enter presence with custom client-id and data
├── Check presence member count → get channel occupancy
│ (stale members? ungraceful disconnects take ~15s to be removed)
└── Watch all presence events → subscribe to logs filtered by channel.presence, or inspect the channel in the dashboard
Connection problems
├── Can I connect at all? → test connection (try ws and xhr separately)
├── Is Ably up? → check service status
├── Watch connection lifecycle → subscribe to connection lifecycle logs
└── Connection count vs plan limit → check app stats in live mode
Auth errors
├── Is the API key valid? → test connection with the specific key
├── What capabilities does key have? → list auth keys
├── Using tokens (JWT or Ably)? → issue a test token via CLI to verify the key can create valid tokens
│ (CLI token issuance tests the key, not your app's authUrl/authCallback)
├── Token expired (40142)? → check TTL and renewal config (authUrl/authCallback)
└── Look up the error code → ask the support agent or fetch help.ably.io/error/{code}
Channel state / lifecycle issues
├── Watch channel events → subscribe to channel lifecycle logs
├── Watch all app meta events → subscribe to all logs
├── Check channel occupancy → get or subscribe to occupancy
└── Check channel rules/config → list channel rules (persistence, TLS, push, etc.)
Push notifications not working
├── Watch push delivery logs → subscribe to push logs (meta channel)
├── Check push log history → get push log history
├── Is push enabled on namespace? → list channel rules, check push-enabled
└── Check integration rules → list integrations, check source type and channel filter
Integration rules not firing
├── List all integrations → list integrations to see rules, source types, status
├── Check source type matches → source can be channel.message, channel.presence,
│ channel.lifecycle, or presence.message
├── Check channel filter → filter pattern must match the channel name
├── Is the rule enabled? → check integration status (enabled/disabled)
└── Check for delivery errors → check log history — the log metachannel captures
errors sending on integrations
Queue issues
├── Are queues configured? → list queues
├── Is the integration routing to it?→ list integrations, check AMQP rule target
└── Check message flow → subscribe to the source channel to verify messages exist
Chat room issues (@ably/chat)
├── Are messages flowing? → subscribe to room messages
│ (if CLI sees messages but app doesn't → room.attach() likely missing)
├── Check room presence → subscribe to room presence
├── Check occupancy → get room occupancy
├── Check underlying channel events → inspect the room's channels in the dashboard, or subscribe to channel lifecycle logs and look for the room's channel names
└── Send a test message → send a message to the room from CLI
Spaces issues (@ably/spaces)
├── Who is in the space? → subscribe to space members
├── Watch cursors → subscribe to space cursors
├── Watch locations → subscribe to space locations
└── Check locks → get all locks in the spacepersisted: truepresencesubscribepublish:["chat:*"]chat:chat:room-1chatauthUrlauthCallback[meta]*ably logs[meta]log[meta]channel.lifecycle*[meta]*[*]*[*]*ably logsably channels inspect <channel>[meta]inspect:*ably accounts login --endpoint <host>help.ably.io/error/{code}ably support ask "error {code}"ABLY_API_KEYexport ABLY_API_KEY=...ABLY_TOKENably loginably apps listably apps switchably auth keys listably loginchannel.lifecyclechannel.occupancychannel.presenceconnection.lifecyclepush.publish{"role": "server"}ably support ask "your question"--continueably statussubscribepresence enterstats --liveoccupancy subscribe--duration N| State | Meaning | Diagnostic |
|---|---|---|
| Attempting connection | Normal on startup; if stuck, check network/auth |
| Active WebSocket | Healthy |
| Temporary loss, SDK retries | Transient is normal; recurring = network issues → watch connection lifecycle logs |
| Offline >2 min, less frequent retries | Test connection to check connectivity |
| Permanent failure, SDK won't retry | Almost always auth — test with the specific API key |
| Explicitly closed by code | Search for |
| State | Meaning | Diagnostic |
|---|---|---|
| Channel object created, not yet attached | Normal before first subscribe/publish |
| Requesting attach from server | If stuck, check connection state and auth capabilities |
| Active — messages flowing | Healthy |
| Requesting detach | Normal during cleanup |
| Not attached, no messages flowing | Check if |
| Attach failed, will retry | Usually follows connection suspension — check connection state first |
| Permanent channel failure | Often capability denied (40160) or invalid channel name |
| Environment | Symptom | Root Cause | Diagnostic |
|---|---|---|---|
| Next.js SSR | Connection fails during render | No WebSocket in server-side render | Guard with |
| Serverless (Lambda, Edge) | Stale/frozen connections | Connection frozen between invocations | Use |
| React StrictMode | Duplicate messages, presence flicker | Double-render duplicates subscriptions | Check occupancy — much higher than expected = duplicates |
| CSP headers | WebSocket blocked | Ably domains not in | Test connection — ws fails, xhr works = CSP |
| Corporate proxy | WebSocket fails silently | Proxy blocking upgrade | Test connection — ws fails, xhr works = proxy |
| Mobile background | Messages missed after resume | OS kills WebSocket | Check channel history for messages sent during gap |