nuxt-modules / og-image

Generate OG Images with Vue templates in Nuxt.
https://nuxtseo.com/og-image
415 stars 27 forks source link

connectWS is not defined #28

Closed oneart-dev closed 1 year ago

oneart-dev commented 1 year ago

Describe the bug

I added to pages/index.vue

defineOgImageStatic({
  title: 'Welcome to my site!',
  background: 'lightblue'
})

Visiting http://localhost/__og_image__/og.png - no problem mostly, image generated

But visiting http://localhost/__og_image__ return blank page

Error trace:

Uncaught ReferenceError: connectWS is not defined at entry.3ad25beb.js:5:40598
(anonymous) @ entry.3ad25beb.js:5

And pointing to:

const km = Pe(Date.now())
  , dl = Pe(null)
  , Pa = window.location.host
  , Pm = `${window.location.protocol}//${Pa}`
  , Yt = Pe("/")
  , Xs = ka(()=>{
    km.value = Date.now()
}
, 200)
  , Sm = {
    refresh() {
        Xs()
    }
};
await connectWS(Pa);  // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
const x_ = createBirpcClient(Sm)
  , zt = Pe(null)
  , E_ = computed(()=>`${Pm}${Yt.value === "/" ? "" : Yt.value}`);
const Sa = (e,t)=>{
    const n = e.__vccOpts || e;
    for (const [r,s] of t)
        n[r] = s;
    return n
}
;

Reproduction

No response

System / Nuxt Info

Nuxt info

- Operating System: `Darwin`
- Node Version:     `v18.13.0`
- Nuxt Version:     `3.3.1`
- Nitro Version:    `2.3.1`
- Package Manager:  `yarn@1.22.17`
- Builder:          `vite`
- User Config:      `app`, `runtimeConfig`, `experimental`, `nitro`, `postcss`, `modules`, `robots`, `fontMetrics`, `i18n`, `googleFonts`, `image`, `router`
- Runtime Modules:  `@nuxtjs/google-fonts@3.0.0-1`, `@nuxtjs/tailwindcss@6.4.1`, `@vueuse/nuxt@9.13.0`, `@nuxtjs/i18n@8.0.0-beta.10`, `@nuxt/image-edge@1.0.0-27954023.4cee565`, `@vueuse/motion/nuxt@2.0.0-beta.25`, `@nuxtjs/fontaine@0.2.4`, `@nuxtjs/robots@3.0.0`, `@nuxtjs/critters@0.4.0`, `nuxt-icon@0.3.3`, `nuxt-og-image@1.5.5`
- Build Modules:    `-`
harlan-zw commented 1 year ago

Hey @oneart-dev, thanks for the issue :)

Can you try out 2.0.0-beta.2 and let me know if works any better?

dargmuesli commented 1 year ago

Would it be possible to have this fix land in v1 as well? :pray: The most recent v1 version v1.5.5 is currently broken, which I use through nuxt-seo-kit and which includes the fix for special character escaping that I'd like to apply.

harlan-zw commented 1 year ago

Would it be possible to have this fix land in v1 as well? pray The most recent v1 version v1.5.5 is currently broken, which I use through nuxt-seo-kit and which includes the fix for special character escaping that I'd like to apply.

You should be able to manually add the nuxt-og-image@beta as a dependency with nuxt-seo-kit,.

I've pushed up a v1.5.6 with the fix for you though :+1:

dargmuesli commented 1 year ago

Thank you! :heart: