joseph013318
joseph013318
Explore posts from servers
BABetter Auth
Created by Ahmed on 3/6/2025 in #bug-reports
getSessionCookie() return null is some cases
22 replies
BABetter Auth
Created by Ahmed on 3/6/2025 in #bug-reports
getSessionCookie() return null is some cases
Hey @Ravi does this solve the infinite pending state issue also?
22 replies
BABetter Auth
Created by Ahmed on 3/6/2025 in #bug-reports
getSessionCookie() return null is some cases
Please explain about the config
22 replies
BABetter Auth
Created by Ahmed on 3/6/2025 in #bug-reports
getSessionCookie() return null is some cases
@Ahmed Does this solves the session null issue? And infinite pending state?
22 replies
BABetter Auth
Created by Muhammad Isa on 2/5/2025 in #help
Pending state is not changing even after the data is available.
😭😭
21 replies
BABetter Auth
Created by Muhammad Isa on 2/5/2025 in #help
Pending state is not changing even after the data is available.
Hey @bekacru any update on the issue?
21 replies
BABetter Auth
Created by joseph013318 on 2/25/2025 in #help
Pending state not resolving!
Hey @Amit Sharma did your error resolved?
10 replies
BABetter Auth
Created by joseph013318 on 3/1/2025 in #help
While deploying - A Node.js API is used (process.exit at line: 1451) which is not supported in..
@lonelyplanet Sure. import { getSessionCookie } from "better-auth/cookies"; import { NextResponse } from "next/server"; export async function middleware(request) { const sessionCookie = getSessionCookie(request); console.log("sessionCookie", sessionCookie); // Optionally pass config as the second argument if cookie name or prefix is customized. if (!sessionCookie) { return NextResponse.redirect(new URL("/login", request.url)); } return NextResponse.next(); } export const config = { matcher: ["/dashboard"], }; Only in build time the error is occuring
12 replies
BABetter Auth
Created by invocation97 on 2/7/2025 in #help
listUsers returns status 401 UNAUTHORIZED even though the current user is an admin.
@invocation97 Thankyou soo much 🙏 Was facing the same issue. They should include this in the docs
11 replies
BABetter Auth
Created by joseph013318 on 2/25/2025 in #help
Pending state not resolving!
Yes @Amit Sharma that would be better. I too was facing the issue but implement the above hack to solve for the time being!
10 replies
BABetter Auth
Created by joseph013318 on 2/25/2025 in #help
Pending state not resolving!
@Amit Sharma Yes same issue, but the update should fix the issue I guess. Check with better-auth 1.2.0 update, if still the same then you can try this code https://github.com/better-auth/better-auth/issues/1006#:~:text=last%20week-,I%20have%20solution.,-When%20component%20with
10 replies
BABetter Auth
Created by joseph013318 on 3/1/2025 in #help
While deploying - A Node.js API is used (process.exit at line: 1451) which is not supported in..
@Ping @lonelyplanet Yes using it in middleware. This is the exact code I used as in the better-auth docs https://www.better-auth.com/docs/integrations/next#middleware I need protected routes with auth! How do I solve the issue?
12 replies
BABetter Auth
Created by joseph013318 on 3/1/2025 in #help
While deploying - A Node.js API is used (process.exit at line: 1451) which is not supported in..
How to resolve the issue? I am deploying in vercel with better-auth as authentication
12 replies
BABetter Auth
Created by joseph013318 on 2/27/2025 in #help
Prisma database with Prisma orm showing Cache skipped reason: (auto no cache)
Oh okay understood. Actually prisma api was also hitting! Thankyou understood!
5 replies
BABetter Auth
Created by Muhammad Isa on 2/5/2025 in #help
Pending state is not changing even after the data is available.
Okay will try that! Thanks anyway!
21 replies
BABetter Auth
Created by Muhammad Isa on 2/5/2025 in #help
Pending state is not changing even after the data is available.
Yes, literally searched two days for the solution but couldn't find until I came across the above code. I don't wanna switch the auth I just love better-auth. I will try to reproduce the issue and share the code!
21 replies
BABetter Auth
Created by Muhammad Isa on 2/5/2025 in #help
Pending state is not changing even after the data is available.
Exactly!
21 replies
BABetter Auth
Created by Muhammad Isa on 2/5/2025 in #help
Pending state is not changing even after the data is available.
import { authClient } from "@/lib/auth-client"; import { useEffect, useRef } from "react"; function useBetterAuthSession() { const { data, isPending, error, //error object refetch, } = authClient.useSession(); // Track the latest value of isPending const isPendingRef = useRef(isPending); useEffect(() => { isPendingRef.current = isPending; }, [isPending]); useEffect(() => { if (isPending) { const timerNotify = setTimeout(() => { if (isPendingRef.current) { refetch(); // sends another get-session request to the server //authClient.$store.notify("$sessionSignal"); // or this poke store to trigger a re-render } }, 2500); // after 2.5 seconds of pending, force resetting client store const timerReload = setTimeout(() => { if (isPendingRef.current) { window.location.reload(); } }, 5000); // after 5 seconds of pending, reload the page return () => { clearTimeout(timerNotify); clearTimeout(timerReload); }; } }, [isPending]); return { data, isPending, error, }; } export default useBetterAuthSession; In mean time this worked, Someone suggested on github. (https://github.com/better-auth/better-auth/issues/1006#:~:text=last%20week-,I%20have%20solution,-.)
21 replies
BABetter Auth
Created by Muhammad Isa on 2/5/2025 in #help
Pending state is not changing even after the data is available.
In my navbar I am showing login button. When login is done in place of login button the profile card will appear so in mean time the loader is shown.
21 replies
BABetter Auth
Created by Muhammad Isa on 2/5/2025 in #help
Pending state is not changing even after the data is available.
@bekacru It's happening for me using Oauth and in worst prossible time almost going in production 😭, the loader is infinite sometimes. I will reproduce and share that same with you!
21 replies