Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: need to include "use client" in error.tsx file #26532

Closed
wants to merge 1 commit into from

Conversation

dhairyathedev
Copy link

@dhairyathedev dhairyathedev commented May 18, 2024

I have read the CONTRIBUTING.md file.

YES

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

In the latest Supabase documentation, there's a code snippet for error.tsx, which is currently set up as a server component.
This causes an error in the Next.js application. To convert error.tsx into a client component, we need to add use client at the top of the file.

Docs Page: https://supabase.com/docs/guides/auth/server-side/nextjs

You can verify this at the official nextjs documentation - https://nextjs.org/docs/app/building-your-application/routing/error-handling

Screenshot 2024-05-18 at 4 26 29 PM

Copy link

vercel bot commented May 18, 2024

@dhairyathedev is attempting to deploy a commit to the Supabase Team on Vercel.

A member of the Team first needs to authorize it.

@charislam
Copy link
Contributor

Thanks @dhairyathedev! The difference between the tutorial and your case is that you're using an error-catching page (error.tsx) and the tutorial is using a normal page that just happens to be named error (error/page.tsx). Since it's a normal page, it's renderable server-side.

Throwing an error and catching it is certainly another possible pattern to use for Next.js, but since that's not what we do in the tutorial, I'm going to close this one for now.

Feel free to reopen if I've misunderstood the problem.

@charislam charislam closed this May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants