RealTimeX
Start For Free

RealTimeX

Package Documentation

IntroductionPrerequisitesInstallationProject setupQuick start
Package structureConfigurationComponentsHooksAPI integrationSocket events
OverviewReplace entire UIReplace componentsStyle with classNamesThemes & localePhone & video callingIn-call control barFeatures
TroubleshootingFAQVersion historyBest practicesSupport & contact

Package Reference

Troubleshooting

Overview

Most integration issues fall into a few buckets: Tailwind scanning, credentials (especially JWT _id), viewport height, and framework bundler config. Use the table below for a quick lookup, then read the deep dives for the highest-impact fixes.

Related guides: Project Setup, FAQ, and Customization.

Common problems

ProblemCauseFix
Unstyled / broken UIMissing Tailwind @source entriesAdd @source pointing at dist/index.mjs and dist/index.cjs
No styles at allMissing styles.css import@import "@realtimexsco/live-chat/styles.css"
Wrong @source depthNext.js vs Vite path differenceUse ../../node_modules in src/app/globals.css
TypeScript: no declaration filePublished tarball missing dist/index.d.tsReinstall the latest version; verify dist/index.d.ts exists
Next.js build errorPackage not transpiledtranspilePackages: ["@realtimexsco/live-chat"]
"use client" errorServer Component importAdd "use client" to the chat page
Whole page scrolls, not just messagesMissing height chainSet viewportHeight="screen" or "calc(100dvh - 4rem)"
Messages don't loadWrong credentials / CORSCheck apiUrl, JWT, and dev proxy configuration
Socket won't connectWrong socketUrlsocketUrl must not include /api/v1
Duplicate React hooks errorDuplicate React copiesdedupe: ["react", "react-dom"] in Vite config
Sent message shows on both left and right_id mismatch or duplicate echoEnsure loggedUserDetails._id matches the JWT _id
Custom layout has no dataMissing hook callCall useChatController() inside your custom ChatLayout
Custom MembersDrawer still shows package UIPackage version older than 1.1.55Upgrade to 1.1.55 or later
Custom drawer works but other slots reverted to defaultExpected behaviorOnly slots you pass in components are overridden
Passed components but a slot is unchangedSlot not wired, or a parent slot was replacedCheck the Components wired-slots table; replace ChannelHeader to override all header drawers
Custom HeaderCallActions crashesRecursive import of the package's own HeaderCallActionsRender your own buttons instead of importing the package component
Vite shows stale UI after upgradeCached prebundlerm -rf node_modules/.vite && pnpm dev
Rate limit banner appearsAPI returned HTTP 429Wait for the cooldown; reduce rapid API calls in development

Unstyled or broken UI

Symptom: Chat renders as a bare list of text with no spacing, colors, or layout.

Check: Your global CSS imports Tailwind, the package stylesheet, and @source entries that point at the published dist files with the correct relative depth.

css
@import "tailwindcss";
@import "@realtimexsco/live-chat/styles.css";
/* Vite (src/index.css): */
@source "../node_modules/@realtimexsco/live-chat/dist/index.mjs";
@source "../node_modules/@realtimexsco/live-chat/dist/index.cjs";
/* Next.js (src/app/globals.css): use ../../node_modules/... */

Copy the full token block from Project Setup so --chat-theme exists under :root.

JWT / _id mismatch

Symptom: Your sent messages appear on both sides of the thread, contacts look empty, or session sync fails.

Fix: Decode the JWT payload and set loggedUserDetails._id to the same _id (or id) claim. Prefer deriving it automatically:

tsx
function userIdFromToken(token: string): string | undefined {
  try {
    const payload = JSON.parse(
      atob(token.split(".")[1].replace(/-/g, "+").replace(/_/g, "/")),
    );
    return payload._id || payload.id;
  } catch {
    return undefined;
  }
}

Viewport height chain

Symptom: The whole page scrolls instead of only the message list, or the chat collapses to a short strip.

Fix: Give ChatMain an explicit height and ensure ancestors can shrink (min-h-0 / flex children). Use viewportHeight="screen" for a full-page chat, or a calc under a fixed app header:

tsx
<ChatMain
  {...chatConfig}
  viewportHeight="calc(100dvh - 4rem)"
/>

Next.js transpilePackages

Symptom: Next.js fails to compile the package, or you see ESM / client-boundary errors when importing ChatMain.

Fix: Add the package to transpilePackages, mark the chat page with "use client", and use the PostCSS Tailwind plugin as shown in Project Setup.

typescript
const nextConfig = {
  transpilePackages: ["@realtimexsco/live-chat"],
};

export default nextConfig;
PreviousFeaturesNextFAQ

On this page

OverviewCommon problemsUnstyled or broken UIJWT / _id mismatchViewport height chainNext.js transpilePackages