supabase-community / auth-ui

Pre-built Auth UI for React
https://supabase.com/docs/guides/auth/auth-helpers/auth-ui
MIT License
487 stars 121 forks source link

Got `ReferenceError: merge is not defined` when deployed to Vercel with NextJS 13 #65

Closed laubonghaudoi closed 1 year ago

laubonghaudoi commented 1 year ago

Bug report

I am using @supabase/auth-ui-react with Nextjs 13, and when I deployed my app to Vercel and went to the auth page, it gave me an client-side error like the screenshot shows below. Application error: a client-side exception has occurred (see the browser console for more information).

I got no error when developing locally with yarn dev, and no error when yarn build either. It only occurs when deployed to Vercel. Is this a bug related to Webpack?

Screenshots

image image

I clicked into the file prompted by the last line of error at MessagePort.T (framework-3b5a00d5d7e8d93b.js:33:1904) and it seems like Webpack-related.

image

System information

silentworks commented 1 year ago

You probably have a outdated lock file. Update your lock file and try again, also are you able to replicate this locally? It would be good if you could provide a minimal repo with this issue so I can test it locally and deploy to vercel to see this too.

laubonghaudoi commented 1 year ago

Hi @silentworks , yes I have updated my yarn.lock file but the issue still persists. I just created a minimal repo: https://github.com/laubonghaudoi/supabase-auth-bug

I deployed it to vercel using my supabase db. Here is the root url: https://supabase-auth-bug.vercel.app/

And when I go to https://supabase-auth-bug.vercel.app/account which is the auth ui, it gave the same error:

image

I suspect that this is a Next 13 related. Because I didn't have this issue when I was using Next 12. This happened only after I migrated to Next 13.

Also I am using Mantine UI, not sure it would have any conflicts too.

nkeat12 commented 1 year ago

Any updates here?

sagarchoudhary96 commented 1 year ago

https://github.com/supabase/auth-ui/issues/45 this just-merge package is the one causing this i reverted to previous version where it was using lodash and it works fine :)

laubonghaudoi commented 1 year ago

Hi @sagarchoudhary96 , do you mean that this is introduced from https://github.com/supabase/auth-ui/pull/57 ? This is added in 0.2.4, so I should downgrade it to 0.2.3 instead?

sagarchoudhary96 commented 1 year ago

yes, it works with that just downgrade to 0.2.3. i will try to raise a PR to fix the same.

silentworks commented 1 year ago

This should be fixed now in the latest 0.2.6 version.

laubonghaudoi commented 1 year ago

Just upgraded and verified that the error is gone. Thanks!