Skip to content

TypeError: Cannot read properties of undefined (reading 'getUid') #45

@sonu-tz

Description

@sonu-tz

🐛 Describe the problem

We are intermittently seeing the following runtime error coming from the CometChat JavaScript SDK:

TypeError: Cannot read properties of undefined (reading 'getUid')

Stack trace points to an internal SDK file:

@cometchat/chat-sdk-javascript/CometChat.js:3542

Snippet from the SDK:

uid: G.user.getUid()

It appears that G.user is undefined at runtime and the SDK attempts to access .getUid() without a null check, causing an uncaught exception.

This error originates inside the SDK bundle (not application code) and is being reported in Sentry as a vendor error.


What was the expected behavior?

The SDK should not throw uncaught runtime exceptions internally.
If the user object is not available, the SDK should handle it safely without crashing.


Reproduction

Currently, we do not have reliable or consistent reproduction steps.

The issue appears intermittently in production and is only observable via error monitoring (Sentry).
We are sharing this report to understand:

  • if this is a known issue
  • what conditions might cause it
  • or if any SDK-side safeguards/workarounds are recommended

Environment

  • Version used:
    "@cometchat/chat-sdk-javascript": "^4.0.12",
    "@cometchat/chat-uikit-angular": "~4.3.21",

  • Framework: Angular

  • Browser: Chrome

  • Error monitoring: Sentry

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions