nuxt-modules / og-image

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

Supabase Authentication redirects are breaking OG Images #100

Open T-Zahil opened 11 months ago

T-Zahil commented 11 months ago

Describe the bug

Hi there 👋

I'm having a little issue with this module. The __og_image__ page isn't working when I use the official Nuxt module (https://supabase.nuxtjs.org).

I strongly suspect this is because of their new auto-redirect when not logged in. I try to add the __og_image__ page to the exclude array, but no luck.

I'm not sure if I should post this issue here or on the Supabase module repo, feel free to tell me if I'm wrong.

I provided a reproduction, but I can't find a way to add and save a .env file though 😅 you need to create one and add this:

SUPABASE_URL="https://example.supabase.co" SUPABASE_KEY="<your_key>"

Reproduction

https://stackblitz.com/edit/nuxt-starter-j2gyhh

System / Nuxt Info

No response

EDIT: It works when I completely disable the "redirect" option from the supabase module, but doesn't work if I write ['/*'] in the exclude option 🤔

peterkimzz commented 11 months ago

Same configuration, same problem, but I still get error 500 when I disable the redirect option of Supabase.

harlan-zw commented 11 months ago

Hm, this is a tricky one. Basically, the Nitro server needs to fetch the route that you're trying to generate the og image for to get the metadata.

If you're redirecting on the root path though then you're probably going to run into other issues with link sharing.

I'll have a think about what can be done, we can at least provide a better error message.