Ravi
Ravi
BABetter Auth
Created by Ravi on 2/21/2025 in #help
signInEmail isn't properly setting cookies in production? (NextJS 15/Vercel)
Hello, I'm using Vercel to deploy my web app and everything works fine when I'm not working with a production environment or when I don't use 'useSecureCookies'. I believe that when I try to sign in via email, the cookie is not being properly set. In auth.ts: I have nextcookies() in my plugins and it's my last one, and I have crossSubdomainCookies activated. In my client component for login, it's calling a server action signin.ts: "use server"; import { auth } from "@/auth"; export const signIn = async (email: string, password: string) => { console.log("signing in..."); try { const response = await auth.api.signInEmail({ body: { email, password, }, asResponse: true, // returns a response object instead of data }); console.log("response from sign in", response); if (response.status === 200) { return true; } else { return false; } } catch (APIError) { console.error(APIError); throw APIError; } }; In my middleware, I'm fetching the session this way: console.log("cookies", request.cookies.getAll()); const getSessionUrl = BASE_URL + "/api/auth/get-session"; console.log("getSessionUrl", getSessionUrl); const session = await fetch(getSessionUrl, { headers: { cookie: request.headers.get("cookie") || "", }, }); When I am in production, the logs show that there are no cookies.
4 replies
BABetter Auth
Created by Ravi on 2/14/2025 in #help
The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received Date
[Better Auth]: Failed to create user TypeError: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received an instance of Date at Array.forEach (<anonymous>) { code: 'ERR_INVALID_ARG_TYPE' } BetterAuth Error Details: Error name: BetterCallAPIError Error message: API Error: UNPROCESSABLE_ENTITY Failed to create user Error stack: [Error [BetterCallAPIError]: API Error: UNPROCESSABLE_ENTITY Failed to create user] { status: 'UNPROCESSABLE_ENTITY', headers: Headers {}, body: [Object], [cause]: [Object] } ⨯ unhandledRejection: [Error [BetterCallAPIError]: API Error: UNPROCESSABLE_ENTITY Failed to create user] { status: 'UNPROCESSABLE_ENTITY', headers: Headers {}, body: [Object], [cause]: [Object] } ⨯ unhandledRejection: [Error [BetterCallAPIError]: API Error: UNPROCESSABLE_ENTITY Failed to create user] { status: 'UNPROCESSABLE_ENTITY', headers: Headers {}, body: [Object], [cause]: [Object]
9 replies