nuxt-modules / og-image

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

Module not working with Netlify Edge Nitro Preset #80

Closed schneider-carlo closed 9 months ago

schneider-carlo commented 1 year ago

Describe the bug

When using this module with NITRO_PRESET=netlify-edge set, the build process on netlify will be stopped with the following error: "Uncaught (in promise) Error: The module's source code could not be parsed: Unexpected character '\u{7f}' at file:///root/.netlify/edge-functions/server/server.js:2:4".

Reproduction

  1. checkout this branch in netlify: https://github.com/schneider-carlo/nuxt-3-starter 2. set env variable NITRO_PRESET to the value netlify-edge 3. start deployment

System / Nuxt Info

- Operating System: `Darwin`
- Node Version:     `v18.17.1`
- Nuxt Version:     `3.7.1`
- CLI Version:      `3.8.0`
- Nitro Version:    `2.6.3`
- Package Manager:  `yarn@1.22.19`
- Builder:          `-`
- User Config:      `modules`
- Runtime Modules:  `nuxt-og-image@2.0.25`
- Build Modules:    `-`
harlan-zw commented 1 year ago

I'm not sure if this was fixed upstream or something, I've tried to replicate it without much success. Can you see if it's fixed on your end when you delete lock file + node_modues and install latest?

schneider-carlo commented 1 year ago

Hi Harlan, I updated all the packages and the issue is still relevant. I found out, that if you deploy the website the first time on netlify and add the env variable, the issue doesn't happen. But when I deploy this repo without any env variables set and after that add the env variable for netlify edge and reploy with clearing cache, the issue comes again.

harlan-zw commented 11 months ago

This is still broken on Netlify edge, I need to find a solution when I have some time to dedicate to it.

harlan-zw commented 9 months ago

This should be solved in the v3.

You can see Netlify Edge rendering here: https://nuxtseo.com/og-image/guides/compatibility#provider-examples