Quick Reference
| Issue | Fix |
|---|---|
init() fails | Verify App ID and Region from Dashboard |
| Login fails with “UID not found” | Create user via Dashboard or REST API first |
| SDK methods fail | Ensure init() completes before calling other methods |
| No real-time events | Check WebSocket connection, verify listeners registered |
| SSR errors | Use dynamic imports or useEffect for client-side only |
Initialization & Authentication
| Symptom | Cause | Fix |
|---|---|---|
init() fails with “App ID not found” | Invalid App ID or Region | Verify credentials in Dashboard → API & Auth Keys |
init() fails silently | Missing credentials | Double-check App ID and Region are strings, not undefined |
| ”CometChat not initialized” | init() not awaited | Ensure init() resolves before calling other methods |
| Login fails with “UID not found” | User doesn’t exist | Create user via Dashboard or REST API |
| Login fails with “Auth Key is not valid” | Wrong Auth Key | Verify Auth Key in Dashboard. Don’t confuse with REST API Key |
getLoggedinUser() returns null | Session cleared or init() not called | Call init() on every app load before checking session |
| Auth Token expired | Token lifetime exceeded | Generate new token via REST API |
| User appears offline after login | Presence not configured | Use subscribePresenceForAllUsers() in AppSettingsBuilder |
Messaging
| Symptom | Cause | Fix |
|---|---|---|
sendMessage() fails | Not logged in or invalid receiver | Ensure login() completes. Verify receiver UID/GUID exists |
| Messages sent but not received | Listener not registered | Register addMessageListener() with onTextMessageReceived |
| Duplicate messages | Multiple listeners | Use unique listener IDs. Remove old listeners first |
| Wrong conversation | Wrong receiver type | Use RECEIVER_TYPE.USER for 1:1, RECEIVER_TYPE.GROUP for groups |
| Media upload fails | File too large or unsupported | Check limits. Supported: PNG, JPG, GIF, MP4, MP3, WAV |
| Metadata not appearing | Set after send | Call setMetadata() before the send method |
| Pagination not working | New request object | Reuse the same MessagesRequest for fetchPrevious()/fetchNext() |
| Thread replies in main chat | Missing filter | Add .hideReplies(true) to MessagesRequestBuilder |
| Deleted messages showing | Missing filter | Add .hideDeletedMessages(true) |
Groups
| Symptom | Cause | Fix |
|---|---|---|
| Cannot join group | Invalid GUID | Verify GUID. Create group first if needed |
| Cannot send to group | Not a member | Join group first with joinGroup() |
| Cannot kick/ban members | Insufficient scope | Only admins and moderators can kick/ban |
| Can’t join private group | Requires invite | Private groups require admin to add you |
| Owner can’t leave | Ownership not transferred | Call transferGroupOwnership() first |
| Password join fails | Wrong password | Pass correct password as second parameter |
fetchNext() returns same results | New request object | Reuse the same GroupsRequest instance |
| Scope filter returns nothing | Invalid strings | Use "admin", "moderator", "participant" |
| Status filter not working | Wrong constant | Use CometChat.USER_STATUS.ONLINE/OFFLINE |
| Cannot demote admin | Not owner | Only group owner can demote admins |
| Kicked user can still see group | Kick vs ban | Use banGroupMember() to prevent rejoining |
Calling
| Symptom | Cause | Fix |
|---|---|---|
| Calls SDK not found | Not installed | Run npm install @cometchat/calls-sdk-javascript |
| No audio/video | Permissions denied | Check browser permissions for camera/microphone |
| Call not connecting | Session ID mismatch | Verify both participants use same session ID |
| One-way audio | Firewall blocking WebRTC | Check network config. Corporate networks may block WebRTC |
| Incoming call not showing | Listener not registered | Register addCallListener() at app root level |
| Black screen after joining | Element not visible | Ensure HTML element has proper dimensions |
| CSS changes not applying | Specificity issue | Try adding !important |
| Styles only work in one mode | Mode-specific classes | Test in DEFAULT, TILE, and SPOTLIGHT modes |
WebSocket & Connection
| Symptom | Cause | Fix |
|---|---|---|
| Real-time events not received | WebSocket disconnected | Check getConnectionStatus(). Reconnect if needed |
| WebSocket fails | Firewall blocking | Check network config. Corporate firewalls may block WebSocket |
| Connection drops frequently | Network instability | Use addConnectionListener() to monitor and reconnect |
| Stuck in “connecting” | Network or config issue | Verify network, appId, and region |
| No events after login | Auto-connect disabled | Call CometChat.connect() manually if autoEstablishSocketConnection(false) |
connect() doesn’t work | Not logged in | Ensure user is logged in first |
Listeners
| Symptom | Cause | Fix |
|---|---|---|
| Events not firing | Registered before init | Register after init() and login() complete |
| Duplicate events | Multiple listeners | Remove old listeners before adding new ones |
| Missing events after navigation | Listeners removed | Re-register when new component mounts |
| Receipt events not triggering | Receipts not sent | Call markAsDelivered()/markAsRead() explicitly |
Typing, Receipts & Reactions
| Symptom | Cause | Fix |
|---|---|---|
| Typing indicator stuck | endTyping() not called | Call on send, blur, or after 3-5s timeout |
| Double-tick not showing | markAsDelivered() not called | Call on message fetch and real-time receive |
| Group receipts missing | Feature not enabled | Enable “Enhanced Messaging Status” in Dashboard |
| Reaction not appearing | UI not synced | Call updateMessageWithReactionInfo() on events |
| Duplicate reactions | No check before adding | Use getReactedByMe() first |
AI Features
| Symptom | Cause | Fix |
|---|---|---|
| AI features not appearing | Not enabled | Enable in Dashboard → AI Features |
| AI Agents not responding | Not configured | Configure Agent in Dashboard. Agents only respond to text |
onAIAssistantEventReceived not firing | Listener not registered | Register AIAssistantListener after login |
| Moderation always PENDING | Rules not configured | Configure rules in Dashboard → Moderation → Rules |
| Agentic messages not arriving | Wrong listener | Use MessageListener with onAIAssistantMessageReceived |
SSR / Framework-Specific
| Symptom | Cause | Fix |
|---|---|---|
| ”window is not defined” | SDK accessed during SSR | Use dynamic imports or useEffect |
| Next.js SSR error | Server render | Use await import('@cometchat/chat-sdk-javascript') |
| Nuxt “document is not defined” | Server render | Import in mounted() lifecycle hook |
| React Native errors | Wrong SDK | Use @cometchat/chat-sdk-react-native |
Upgrading from V3
| Symptom | Cause | Fix |
|---|---|---|
| ”Module not found” | Old import paths | Replace @cometchat-pro/chat with @cometchat/chat-sdk-javascript |
| Calls SDK not working | Wrong package | Use @cometchat/calls-sdk-javascript |
| Both versions installed | Package conflict | Remove v3 package completely |
Error Codes
| Code | Description | Resolution |
|---|---|---|
ERR_UID_NOT_FOUND | User doesn’t exist | Create user via Dashboard or REST API |
ERR_AUTH_KEY_NOT_FOUND | Invalid Auth Key | Verify in Dashboard |
ERR_APP_NOT_FOUND | Invalid App ID or Region | Check Dashboard |
ERR_NOT_LOGGED_IN | No active session | Call login() first |
ERR_GUID_NOT_FOUND | Group doesn’t exist | Create group or verify GUID |
ERR_NOT_A_MEMBER | Not a group member | Join group first |
ERR_BLOCKED | User is blocked | Unblock via Dashboard or SDK |
ERR_RATE_LIMIT_EXCEEDED | Too many requests | See Rate Limits |
Next Steps
Setup SDK
Installation and initialization guide
Best Practices
Recommended patterns and practices
AI Integration
AI Agents, Moderation, and Copilot
Support
Open a support ticket