HotShot
HotShot
BABetter Auth
Created by HotShot on 4/6/2025 in #help
Issue trying to convert to cloudflare workers
I have my project currently deployed on vercel as a NextJs project. I'm trying to convert it to cloudflare workers using opennextjs/cloudflare, however I'm encountering some issues with the auth handler.
/api/auth/get-session - Exception Thrown @ 4/5/2025, 9:35:09 PM
✘ [ERROR] Error: The script will never generate a response.


✘ [ERROR] Error: Promise will never complete.
/api/auth/get-session - Exception Thrown @ 4/5/2025, 9:35:09 PM
✘ [ERROR] Error: The script will never generate a response.


✘ [ERROR] Error: Promise will never complete.
and my current auth setup:
export function getAuth() {
const db = getDB();

return betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
}),
trustedOrigins: [env.NEXT_PUBLIC_BETTER_AUTH_URL],
plugins: [
username(),
nextCookies(),
],
secret: env.BETTER_AUTH_SECRET,
baseURL: env.NEXT_PUBLIC_BETTER_AUTH_URL,
emailAndPassword: {
enabled: true,
},
});
}
export function getAuth() {
const db = getDB();

return betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
}),
trustedOrigins: [env.NEXT_PUBLIC_BETTER_AUTH_URL],
plugins: [
username(),
nextCookies(),
],
secret: env.BETTER_AUTH_SECRET,
baseURL: env.NEXT_PUBLIC_BETTER_AUTH_URL,
emailAndPassword: {
enabled: true,
},
});
}
// /api/auth/[...all]/route.ts (tried this way to instantiate db every request, didn't work)
export async function POST(req: NextRequest) {
const auth = getAuth();
const authHandler = toNextJsHandler(auth);
return authHandler.POST(req);
}

export async function GET(req: NextRequest) {
const auth = getAuth();
const authHandler = toNextJsHandler(auth);
return authHandler.GET(req);
}
// /api/auth/[...all]/route.ts (tried this way to instantiate db every request, didn't work)
export async function POST(req: NextRequest) {
const auth = getAuth();
const authHandler = toNextJsHandler(auth);
return authHandler.POST(req);
}

export async function GET(req: NextRequest) {
const auth = getAuth();
const authHandler = toNextJsHandler(auth);
return authHandler.GET(req);
}
3 replies
BABetter Auth
Created by HotShot on 2/23/2025 in #help
Roblox OAuth provider error when linking
# SERVER_ERROR: TypeError: value.toISOString is not a function
at Array.map (<anonymous>)
at Array.map (<anonymous>)
at Array.map (<anonymous>)
GET /api/auth/callback/roblox?code=oMKFK8VC8mhT3Vm4xLwYfEFDxVecZSKeiOO9ZrfHXHls6a2lE7iNH4X7APxP-hpF7y8sakwMsjYMnFuT5Jxaq-bCFRsMRVHrXBWUWCVoP9Dzk8UGlYEJtsXNIp20p_PceGxFVi0WzpKnJ93WObhV_gjj5Tde2ifiAkF3WXpEIZD5Fbhf5zJuQ8Rj3cofU-FHTmbAGmolnuBHVrmOb1XhvR5m2gxPPXl8TcMeL58X_n59Qc9O2AFF5QOYJ-Bh&state=Eowz1-9vIgcz1rtBvpUXMf4hiygonBAb 500 in 200ms
# SERVER_ERROR: TypeError: value.toISOString is not a function
at Array.map (<anonymous>)
at Array.map (<anonymous>)
at Array.map (<anonymous>)
GET /api/auth/callback/roblox?code=oMKFK8VC8mhT3Vm4xLwYfEFDxVecZSKeiOO9ZrfHXHls6a2lE7iNH4X7APxP-hpF7y8sakwMsjYMnFuT5Jxaq-bCFRsMRVHrXBWUWCVoP9Dzk8UGlYEJtsXNIp20p_PceGxFVi0WzpKnJ93WObhV_gjj5Tde2ifiAkF3WXpEIZD5Fbhf5zJuQ8Rj3cofU-FHTmbAGmolnuBHVrmOb1XhvR5m2gxPPXl8TcMeL58X_n59Qc9O2AFF5QOYJ-Bh&state=Eowz1-9vIgcz1rtBvpUXMf4hiygonBAb 500 in 200ms
using better-auth@1.2.0-beta.12 @D3vision
6 replies
BABetter Auth
Created by HotShot on 12/10/2024 in #help
Using Generic OAuth plugin to link social
So I have a user account, and they'll already be signed in, however I want the ability to use Roblox OAuth provider to link their roblox account to the main user. right now the account linking seems to only support the default providers.
24 replies