Skip to main content
Find solutions to common issues when building with the CometChat JavaScript SDK.

Quick Reference

IssueFix
init() failsVerify App ID and Region from Dashboard
Login fails with “UID not found”Create user via Dashboard or REST API first
SDK methods failEnsure init() completes before calling other methods
No real-time eventsCheck WebSocket connection, verify listeners registered
SSR errorsUse dynamic imports or useEffect for client-side only

Initialization & Authentication

SymptomCauseFix
init() fails with “App ID not found”Invalid App ID or RegionVerify credentials in Dashboard → API & Auth Keys
init() fails silentlyMissing credentialsDouble-check App ID and Region are strings, not undefined
”CometChat not initialized”init() not awaitedEnsure init() resolves before calling other methods
Login fails with “UID not found”User doesn’t existCreate user via Dashboard or REST API
Login fails with “Auth Key is not valid”Wrong Auth KeyVerify Auth Key in Dashboard. Don’t confuse with REST API Key
getLoggedinUser() returns nullSession cleared or init() not calledCall init() on every app load before checking session
Auth Token expiredToken lifetime exceededGenerate new token via REST API
User appears offline after loginPresence not configuredUse subscribePresenceForAllUsers() in AppSettingsBuilder

Messaging

SymptomCauseFix
sendMessage() failsNot logged in or invalid receiverEnsure login() completes. Verify receiver UID/GUID exists
Messages sent but not receivedListener not registeredRegister addMessageListener() with onTextMessageReceived
Duplicate messagesMultiple listenersUse unique listener IDs. Remove old listeners first
Wrong conversationWrong receiver typeUse RECEIVER_TYPE.USER for 1:1, RECEIVER_TYPE.GROUP for groups
Media upload failsFile too large or unsupportedCheck limits. Supported: PNG, JPG, GIF, MP4, MP3, WAV
Metadata not appearingSet after sendCall setMetadata() before the send method
Pagination not workingNew request objectReuse the same MessagesRequest for fetchPrevious()/fetchNext()
Thread replies in main chatMissing filterAdd .hideReplies(true) to MessagesRequestBuilder
Deleted messages showingMissing filterAdd .hideDeletedMessages(true)

Groups

SymptomCauseFix
Cannot join groupInvalid GUIDVerify GUID. Create group first if needed
Cannot send to groupNot a memberJoin group first with joinGroup()
Cannot kick/ban membersInsufficient scopeOnly admins and moderators can kick/ban
Can’t join private groupRequires invitePrivate groups require admin to add you
Owner can’t leaveOwnership not transferredCall transferGroupOwnership() first
Password join failsWrong passwordPass correct password as second parameter
fetchNext() returns same resultsNew request objectReuse the same GroupsRequest instance
Scope filter returns nothingInvalid stringsUse "admin", "moderator", "participant"
Status filter not workingWrong constantUse CometChat.USER_STATUS.ONLINE/OFFLINE
Cannot demote adminNot ownerOnly group owner can demote admins
Kicked user can still see groupKick vs banUse banGroupMember() to prevent rejoining

Calling

SymptomCauseFix
Calls SDK not foundNot installedRun npm install @cometchat/calls-sdk-javascript
No audio/videoPermissions deniedCheck browser permissions for camera/microphone
Call not connectingSession ID mismatchVerify both participants use same session ID
One-way audioFirewall blocking WebRTCCheck network config. Corporate networks may block WebRTC
Incoming call not showingListener not registeredRegister addCallListener() at app root level
Black screen after joiningElement not visibleEnsure HTML element has proper dimensions
CSS changes not applyingSpecificity issueTry adding !important
Styles only work in one modeMode-specific classesTest in DEFAULT, TILE, and SPOTLIGHT modes

WebSocket & Connection

SymptomCauseFix
Real-time events not receivedWebSocket disconnectedCheck getConnectionStatus(). Reconnect if needed
WebSocket failsFirewall blockingCheck network config. Corporate firewalls may block WebSocket
Connection drops frequentlyNetwork instabilityUse addConnectionListener() to monitor and reconnect
Stuck in “connecting”Network or config issueVerify network, appId, and region
No events after loginAuto-connect disabledCall CometChat.connect() manually if autoEstablishSocketConnection(false)
connect() doesn’t workNot logged inEnsure user is logged in first

Listeners

SymptomCauseFix
Events not firingRegistered before initRegister after init() and login() complete
Duplicate eventsMultiple listenersRemove old listeners before adding new ones
Missing events after navigationListeners removedRe-register when new component mounts
Receipt events not triggeringReceipts not sentCall markAsDelivered()/markAsRead() explicitly

Typing, Receipts & Reactions

SymptomCauseFix
Typing indicator stuckendTyping() not calledCall on send, blur, or after 3-5s timeout
Double-tick not showingmarkAsDelivered() not calledCall on message fetch and real-time receive
Group receipts missingFeature not enabledEnable “Enhanced Messaging Status” in Dashboard
Reaction not appearingUI not syncedCall updateMessageWithReactionInfo() on events
Duplicate reactionsNo check before addingUse getReactedByMe() first

AI Features

SymptomCauseFix
AI features not appearingNot enabledEnable in Dashboard → AI Features
AI Agents not respondingNot configuredConfigure Agent in Dashboard. Agents only respond to text
onAIAssistantEventReceived not firingListener not registeredRegister AIAssistantListener after login
Moderation always PENDINGRules not configuredConfigure rules in Dashboard → Moderation → Rules
Agentic messages not arrivingWrong listenerUse MessageListener with onAIAssistantMessageReceived

SSR / Framework-Specific

SymptomCauseFix
”window is not defined”SDK accessed during SSRUse dynamic imports or useEffect
Next.js SSR errorServer renderUse await import('@cometchat/chat-sdk-javascript')
Nuxt “document is not defined”Server renderImport in mounted() lifecycle hook
React Native errorsWrong SDKUse @cometchat/chat-sdk-react-native

Upgrading from V3

SymptomCauseFix
”Module not found”Old import pathsReplace @cometchat-pro/chat with @cometchat/chat-sdk-javascript
Calls SDK not workingWrong packageUse @cometchat/calls-sdk-javascript
Both versions installedPackage conflictRemove v3 package completely

Error Codes

CodeDescriptionResolution
ERR_UID_NOT_FOUNDUser doesn’t existCreate user via Dashboard or REST API
ERR_AUTH_KEY_NOT_FOUNDInvalid Auth KeyVerify in Dashboard
ERR_APP_NOT_FOUNDInvalid App ID or RegionCheck Dashboard
ERR_NOT_LOGGED_INNo active sessionCall login() first
ERR_GUID_NOT_FOUNDGroup doesn’t existCreate group or verify GUID
ERR_NOT_A_MEMBERNot a group memberJoin group first
ERR_BLOCKEDUser is blockedUnblock via Dashboard or SDK
ERR_RATE_LIMIT_EXCEEDEDToo many requestsSee 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