wobsoriano / nuxt-clerk-template

Auth starts here with the Nuxt and Clerk Demo
https://nuxt-clerk-template.nuxt.dev
86 stars 11 forks source link

Infinite reload on localhost #1

Closed mvcodelabs closed 1 year ago

mvcodelabs commented 1 year ago

Hi, thanks for this playground and the h3-clerk package, i've been looking for something like this for a while.

I'm trying this playground and on localhost it goes on an infinite loop reloading the page. I tried it on a codespace and it worked the first time.

wobsoriano commented 1 year ago

I have this issue locally as well. The ff. seems related

fanckush commented 1 year ago

issue seems to be fixed for me with h3-clerk 0.3.0 release edit false positive, turns out I needed to update to h3 v1.8.0 and the indeed it's still broken

fanckush commented 1 year ago

@wobsoriano both refererced issues are now resolved yet the bug is still present.

I tried to debug a bit and ended up with this which looks a lot like the issue https://github.com/clerkinc/javascript/issues/1566

Currently waiting on a response from Clerk team, would be great if you have any ideas. There is a chance that the cause of the bug is H3 dev server; maybe it messes up with the headers in one way or another. This would explain why a production build works just fine and the bug only occurs in localhost

wobsoriano commented 1 year ago

@fanckush thanks for linking your issue here. It's definitely the reason that's stopping me from publishing a Nuxt module (h3-clerk and vue-clerk combined).

This is how they handle infinite reloads in Next

https://github.com/clerkinc/javascript/blob/559a0e6e209d8f8662ededdd16421ad38384c3db/packages/nextjs/src/server/authMiddleware.ts#L363

fanckush commented 1 year ago

sweet! i'll see if I can adopt that solution for h3-clerk and open a PR

fanckush commented 1 year ago

PR open