vue-zendesk icon indicating copy to clipboard operation
vue-zendesk copied to clipboard

window.zE ist not a function

Open simonmaass opened this issue 3 years ago • 2 comments

We are seeing some errors in sentry in the "onload" part:

TypeError: window.zE is not a function
  at HTMLScriptElement.n.onload(./node_modules/@dansmaculotte/vue-zendesk/src/index.js:47:16)

simonmaass avatar Aug 12 '21 11:08 simonmaass

Can you give me more details about the browser you use and the options set for the plugin? I cannot reproduce the error you're facing. This call is performed in onload callback, so I don't see why window.zE wouldn't be defined. Did you check your Zendek key? Are your sure you can load the widget with a simple

rtouze avatar Aug 20 '21 08:08 rtouze

@simonmaass - I guess you're using Nuxt or some kind of SSR for your app? If Nuxt, when you add the plugin to your nuxt.config.js, you should register it as client plugin only like this:

plugins: [
   '~/plugins/foo.client.js', // only in client side
  ...
]

or like this:

plugins: [
  { src: '~/plugins/client-only.js', mode: 'client' }, // only on client side
  ...
]

With this settings you should not experience any error like the one you describe.

mirocklez avatar Nov 29 '22 09:11 mirocklez