APTalkmoji Troubleshooting
Docs›SDK Introduction

Troubleshooting

Solutions to the most common issues when deploying Talkmoji embeds, setting up the server, and configuring voice chat.

Widget & Embed

🌐 The chatbot doesn't appear, or the button does nothing, on my website

Open your site, press F12 and look at the Console. The loader prints a line starting with [Talkmoji] that names the cause. The usual ones:

  • "did not start on your-site.com": the chat window was blocked. Check, in this order: (1) Settings → Domains & privacy → Allowed domains is empty or lists your site. example.com also covers www.example.com and the other way round; a subdomain such as shop.example.com needs *.example.com or its own entry, and so does a staging or page-builder preview address. (2) Your site's Content-Security-Policy allows frames from Talkmoji (see below). (3) An ad blocker isn't blocking it; try a private window with extensions off.
  • "Could not find the embed-loader script tag" or "needs data-bot": paste the full tag from Install code, including data-bot="…". A speed plugin (Cloudflare Rocket Loader, WP Rocket "delay JavaScript", Autoptimize) is handled, but if the tag is still missing, exclude embed-loader.js from that plugin.
  • "already on this page": the install code is on the page twice (for example in the theme and in a plugin). Remove one.
  • "Could not load this chatbot's settings": the data-bot id is wrong, or the site's CSP connect-src doesn't list Talkmoji. The chat still opens, but without your saved position, size and display style.

If your site sends a Content-Security-Policy (header or <meta>), add your Talkmoji address (for example https://talkmoji.com) to script-src, frame-src and connect-src, plus wss://talkmoji.com in connect-src for voice, and img-src if your character uses images.

Voice doesn't start on your site: a Permissions-Policy: microphone=() header on your page blocks the microphone for every frame. Allow it for your own site and the frame, e.g. microphone=(self "https://talkmoji.com"). The widget asks for the microphone only when the visitor taps it.

The dashboard says "not seen yet" although it's installed: the widget is detected from the page address your visitors' browsers send. The loader now sets this itself, but if you use the plain iframe, add referrerpolicy="strict-origin-when-cross-origin" to it (the Install code tab already does). Open your site once in a normal window after publishing.

It looks different from the preview: saved settings reach your site as soon as you save, but a caching plugin or CDN can keep an old copy of your page. Clear that cache and hard-refresh.

🔴 Avatar doesn't appear on the page

Most common cause: PUBLIC_GEMINI_API_KEY is missing on the server. The voice path needs a browser-facing Gemini key, and the server deliberately never exposes GEMINI_API_KEY — so with no public key, the embed config returns no apiKey and the widget boots in text-only mode (chat still works via typed messages; the talking avatar doesn't appear).

Fix: Set a separate, restricted browser-safe key in your .env file and restart the server:

GEMINI_API_KEY=AIza...          # required — server-side only, never sent to browsers
PUBLIC_GEMINI_API_KEY=AIza...   # separate key for the voice WebSocket

Also check:

  • The data-bot attribute on the script tag matches your chatbot's Public ID (shown at the top of the setup page and in Install code)
  • The script src points to the correct server URL
  • No Content Security Policy (CSP) header is blocking the script or the Rive CDN
🔇 No audio — the character's mouth doesn't move

Cause: Browsers block autoplay of audio until the user has interacted with the page. The Gemini Live WebSocket audio context is suspended on load.

Fix: The SDK automatically resumes the AudioContext on the first user gesture (click, tap, or keypress) anywhere on the page. Make sure the user clicks something — including the widget launcher — before speaking.

If audio still doesn't play after a click:

  • Check the browser console for AudioContext.resume() failed errors
  • On iOS Safari, ensure the user tapped the launcher (not just tapped elsewhere) — iOS requires the gesture to be on an audio-related element
  • Some browser extensions (ad-blockers, privacy tools) block WebAudio. Test in an incognito window.
🌐 CORS errors in the browser console

Talkmoji's embed routes (/embed/*) allow all origins by default — Access-Control-Allow-Origin: *. This is intentional: the embed widget runs on the visitor's website, not your own domain.

If you're seeing CORS errors:

  • The request is going to the wrong URL (e.g., localhost:3000 instead of your server)
  • A reverse proxy (nginx, Cloudflare) is stripping CORS headers — check your proxy config
  • You have a cors({ origin: 'specific-domain.com' }) override in server.js — the default is cors() (open)

The dashboard API routes (/api/*) also allow all origins. If you want to restrict these, add an origin option to the cors() call in server.js.

📱 Embedding fails on iOS Safari — no microphone access

iOS Safari requires the AudioContext to be created and resumed synchronously in response to a user gesture. The SDK creates the context on the first mic button tap, which satisfies this requirement.

Known issues on iOS:

  • iOS 15 and earlier: WebRTC mic access may fail in WKWebView (used in React Native). Use iOS 16+ or Safari on device for full voice support.
  • Low Power Mode: iOS can throttle requestAnimationFrame to 30fps, causing choppy Rive animations. This is a platform limitation.
  • Autoplay policy: Audio won't play until a tap occurs. This is by design — do not call audioContext.resume() before a user gesture.

For React Native on iOS: Ensure NSMicrophoneUsageDescription is set in Info.plist. See the React Native SDK docs.

👄 Lip sync is out of sync — mouth moves after the speech

This is caused by audio buffer latency — the audio is scheduled in the Web Audio API ahead of the current time, but the lip-sync controller reads from the analyser in real-time.

Fix: Adjust mouthDelayMs to compensate:

// If mouth moves ~100ms AFTER speech, set a negative delay
const avatar = new LipsyncAvatar({
  ...
  mouthDelayMs: -80,  // advance mouth by 80ms relative to audio
});

Typical values range from -50 to -150 depending on the audio buffer size and device. Start with -80 and tune from there.

Also try: Increasing anticipationMs (default 40ms) — this pre-rolls the mouth before the scheduled phoneme starts.

Server & Database

🗄️ Server crashes with "relation does not exist"

The Postgres schema hasn't been applied. Run supabase/schema.sql in your Supabase SQL Editor (or via psql).

psql $DATABASE_URL -f supabase/schema.sql

Also ensure the vector extension is enabled — the schema creates it with CREATE EXTENSION IF NOT EXISTS vector but Supabase Free tier has it available by default.

🔐 JWT errors — "Invalid or expired token"

This happens when JWT_SECRET changes between sessions. Tokens are signed with this secret — if the secret changes, all existing tokens become invalid and users are logged out.

Fix: Set a stable, long-lived JWT_SECRET in your environment. Never regenerate it in production unless you intend to invalidate all sessions:

# Generate a secure secret:
node -e "console.log(require('crypto').randomBytes(48).toString('hex'))"
⚡ Embeddings are slow or timing out

The Gemini Embedding API has rate limits. If you're uploading many files at once, the embedding service will queue requests and may hit the rate limit.

Symptoms: Files stuck in processing status for more than 2 minutes; server logs show [embed] 429 Too Many Requests.

Fix: Upload files one at a time, or add a delay between uploads. The embedding service (backend/services/embed.js) uses exponential backoff on 429 errors but a hard 3-retry limit.

For bulk imports, reduce chunkSize in backend/services/process.js (default 1200 chars) to create smaller chunks and reduce the number of API calls per file.

💳 Stripe webhook returns 400 "signature verify failed"

The Stripe webhook endpoint requires the raw request body for signature verification. If a middleware (body-parser, nginx gzip) modifies the body before it reaches the handler, the signature check fails.

The endpoint is already mounted before express.json() in server.js — this is correct. The issue is usually an nginx reverse proxy applying gzip or a Cloudflare transform rule.

Ensure your reverse proxy passes the body unchanged to the Node process for the path POST /api/billing/webhook.

Still stuck?

Check the server logs first — almost every error is logged with a [route/action] prefix. If you can't find the cause, book a 30-minute setup call or email support@talkmoji.com.