Troubleshooting
Solutions for common issues encountered when integrating the Lovina Chat SDK.
Widget Does Not Appear
The chat bubble is not visible
-
Check the browser console for errors. Open developer tools and look for messages starting with
[Lovina]. -
Verify your configuration. Ensure
websiteTokenandbaseUrlare correct:window.lovinaChatSDK.run({websiteToken: 'YOUR_WEBSITE_TOKEN', // Must match your dashboardbaseUrl: 'https://chat.lovina.app', // Must be reachable}); -
Check
hideMessageBubble. If set totrue, the bubble is intentionally hidden. Open the chat programmatically:window.$lovina.toggle('open'); -
Check script loading order.
window.lovinaSettingsmust be defined before callingwindow.lovinaChatSDK.run(). -
Check for CSS conflicts. Ensure no styles on your page are setting
z-indexhigh enough to cover the widget (the SDK usesz-index: 2147483000).
The widget loads but shows a blank screen
- Verify the
baseUrlis reachable. Open{baseUrl}/widgetin a new browser tab. - Check for mixed content. If your site is served over HTTPS, the
baseUrlmust also use HTTPS.
CSP (Content Security Policy) Issues
If your site uses a Content Security Policy, the SDK requires these directives:
frame-src https://chat.lovina.app;
script-src https://chat.lovina.app;
connect-src https://chat.lovina.app wss://chat.lovina.app;
img-src https://chat.lovina.app;
Replace https://chat.lovina.app with your actual baseUrl if you are self-hosting.
Symptoms of CSP issues
- Widget iframe does not load (check console for
Refused to frameerrors). - WebSocket connections are blocked (check console for
Refused to connecterrors). - Images or uploaded files do not display.
How to diagnose
Open the browser console (F12) and filter for "Refused" or "CSP" errors. Each blocked resource will indicate which CSP directive needs updating.
CORS Errors
CORS errors typically appear when the baseUrl is misconfigured or the server is not set up to accept requests from your domain.
Symptoms
Access-Control-Allow-Originerrors in the browser console.- Messages fail to send with network errors.
Solutions
- Verify
baseUrlis correct -- it must match the server's configured origin exactly (including protocol and port). - Check server CORS configuration -- the Lovina backend must allow your website's origin.
- Check for proxy interference -- reverse proxies (nginx, Cloudflare) may strip or modify CORS headers.
WebView Debugging
Android
- Enable WebView debugging in your app:
WebView.setWebContentsDebuggingEnabled(true)
- Connect the device via USB.
- Open
chrome://inspectin Chrome on your computer. - Select the WebView from the list to open DevTools.
iOS
- Enable Web Inspector in Safari on the device: Settings > Safari > Advanced > Web Inspector.
- Connect the device via USB.
- Open Safari on your Mac, go to Develop > [Device Name] and select the WebView.
Common WebView issues
- File picker does not open -- See the File Upload guide for platform-specific WebView setup.
- Cookies not persisting -- Ensure the WebView allows cookies and local storage.
- JavaScript disabled -- Verify
javaScriptEnabledistruein WebView settings.
File Upload Not Working
Files are not uploading
-
Check the feature flag. Ensure file upload is not disabled:
window.lovinaSettings = {features: {enable_file_upload: true,},}; -
Check file size. Files must be under 10 MB each.
-
Check file count. Maximum 5 files per message.
-
Check accepted types. Only
image/*,application/pdf,text/*,audio/*, andvideo/*are accepted.
File picker does not open on mobile
On Android and iOS WebViews, the native file picker requires platform-specific configuration. See the File Upload guide for setup instructions.
Uploads fail with network errors
- Check that the
baseUrlsupports multipart form data uploads. - Verify there is no file size limit set by a reverse proxy (nginx default is often 1 MB -- you may need to increase
client_max_body_size). - Check for CORS issues on the upload endpoint.
Messages Are Not Sending
-
Check network connectivity. Open the Network tab in developer tools and look for failed requests to
/sdk/chat/. -
Verify the websiteToken. An invalid token results in 401 responses.
-
Enable debug mode for detailed console output:
window.lovinaSettings = {features: { debug_mode: true },};
User Identity Not Persisting
-
Check cookies. The SDK stores session data in cookies. Ensure your site is not blocking or clearing cookies on navigation.
-
Call
setUserafterlovina:ready. Setting the user before the widget loads has no effect:window.addEventListener('lovina:ready', function() {window.$lovina.setUser('user-123', { name: 'Jane' });});
Settings Not Updating
window.lovinaSettings is read once during initialization. To change settings at runtime:
- Use API methods:
setLocale(),setColorScheme(),toggle(), etc. - For settings without a runtime API, call
destroy()and reinitialize:window.$lovina.destroy();window.lovinaSettings = { /* new settings */ };window.lovinaChatSDK.run({ websiteToken: '...', baseUrl: '...' });
Dark Mode Not Working
- Check the
darkModesetting. It should be'dark'or'auto'. - If using
'auto', verify your OS is set to dark mode. The widget followsprefers-color-scheme. - Runtime toggle:
window.$lovina.setColorScheme('dark');
Transport / Connection Issues
The SDK supports three transport protocols with automatic fallback: WebSocket, SSE, and Long Polling. If you experience connection issues:
-
Check firewall rules. WebSocket connections (
wss://) may be blocked by corporate firewalls. The SDK will automatically fall back to SSE or long polling. -
Force a specific transport for debugging:
window.lovinaSettings = {features: {enable_websocket: false,enable_sse: false,enable_long_polling: true, // Only use long polling},}; -
Check proxy configuration. Some reverse proxies (nginx, HAProxy) require explicit WebSocket upgrade configuration.
Getting Help
If you cannot resolve the issue:
- Enable
debug_mode: trueand reproduce the problem. - Copy the console output.
- Note your browser, OS, and SDK version.
- Contact support@ailovina.com with the above information.