You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The <SignIn/> component cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the afterSignIn URL instead. (This notice only appears in development)
#11
Open
Victorosayame opened this issue
Aug 9, 2024
· 7 comments
i keep getting this error even when i did everything correctly, i also cloned yours,created a new clerk and liveblocks account and still gets the same error.
The component cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the afterSignIn URL instead.
(This notice only appears in development)
The text was updated successfully, but these errors were encountered:
Turned my sign in component to a client side one, using 'use client'
Check if there is an user with useUser, redirect to my private dashboard if positive
Show the log in component other-wise
For some reason the sign in page is being sent to the client without an user before hydration, after hydration there is an user and thats where the issue happens.
export const config = {
matcher: [
// Skip Next.js internals and all static files, unless found in search params
"/((?!_next|[^?]\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).)",
// Always run for API routes
"/(api|trpc)(.*)",
],
};**
It checks user authentication on server side itself.
So I removed the redirect to sign-in page from home page and changed it to return null.
import Link from "next/link";
import { redirect } from "next/navigation";
const Home = async () => {
const clerkUser = await currentUser();
if (!clerkUser) return null;
i keep getting this error even when i did everything correctly, i also cloned yours,created a new clerk and liveblocks account and still gets the same error.
The component cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the
afterSignIn
URL instead.(This notice only appears in development)
The text was updated successfully, but these errors were encountered: