From d8fb95e3eb63716ddcbe03c91b39d6ebd47f1092 Mon Sep 17 00:00:00 2001 From: Jacob Hurwitz Date: Fri, 15 May 2026 14:39:31 -0700 Subject: [PATCH] Use dbNoCache for OAuth identity lookups to avoid Hyperdrive cache staleness After linking an account, the cached DB client could serve stale results on the next OAuth login attempt, making it appear the link wasn't saved. Co-Authored-By: Claude Sonnet 4.6 --- worker/routes/oauth.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/worker/routes/oauth.ts b/worker/routes/oauth.ts index a5e48a8..a4ce680 100644 --- a/worker/routes/oauth.ts +++ b/worker/routes/oauth.ts @@ -457,7 +457,7 @@ export function registerOAuthRoutes(app: App) { // Check if user exists with this OAuth identity const existingUser = await c - .get("db") + .get("dbNoCache") .query( "SELECT * FROM users WHERE oauth_provider = $1 AND oauth_sub = $2", [provider, oauthSub], @@ -586,7 +586,7 @@ export function registerOAuthRoutes(app: App) { // Check if user exists const existingUser = await c - .get("db") + .get("dbNoCache") .query( "SELECT * FROM users WHERE oauth_provider = $1 AND oauth_sub = $2", ["google", verified.sub], @@ -821,7 +821,7 @@ export function registerOAuthRoutes(app: App) { // Check if user already exists with this Apple identity const existingUser = await c - .get("db") + .get("dbNoCache") .query( "SELECT * FROM users WHERE oauth_provider = $1 AND oauth_sub = $2", ["apple", verified.sub], @@ -917,7 +917,7 @@ export function registerOAuthRoutes(app: App) { // Check if user already exists with this Google identity const existingUser = await c - .get("db") + .get("dbNoCache") .query( "SELECT * FROM users WHERE oauth_provider = $1 AND oauth_sub = $2", ["google", verified.sub],