Hello Intercom Team,
I’m facing an issue with loading the Intercom messenger in my SvelteKit web app. Sometimes, the messenger in both the local environment and the deployed environment gives an error and it does not showing up, also in firefox it does not work at all:
Uncaught TypeError: Cannot read properties of undefined (reading 'parentNode')
at s (index.YkDx8vIC.js:2:4217)
layout.svelte: (run only in client side)
<script lang="ts">
import '../app.css';
import '../fonts.css';
import { Toaster } from '$lib/components/ui/sonner';
import { onMount } from 'svelte';
import { browser } from '$app/environment';
onMount(async () => {
if (browser) {
const { Intercom } = await import('@intercom/messenger-js-sdk');
Intercom({
app_id: 'XXXX'
});
}
});
</script>
Additionally, I tested it in a normal server-client setup, and it also gives the same error.
How can I fix the issue?