This commit is contained in:
ping-maxwell
2025-10-30 23:40:53 +10:00
parent c4c243f7b9
commit 269027c62f
3 changed files with 14 additions and 3 deletions

View File

@@ -28,6 +28,7 @@ import {
type AdapterFactoryOptions,
createAdapterFactory,
} from "../adapter-factory";
import { logger } from "@better-auth/core/env";
export interface DB {
[key: string]: any;
@@ -425,7 +426,18 @@ export const drizzleAdapter = (db: DB, config: DrizzleAdapterConfig) => {
const schemaModel = getSchema(model);
const clause = convertWhereClause(where, model);
const builder = db.delete(schemaModel).where(...clause);
return await builder;
const res = await builder;
let count = 0;
if (res && "rowCount" in res) count = res.rowCount;
else if (Array.isArray(res)) count = res.length;
else if (res && "affectedRows" in res) count = res.affectedRows;
if (typeof count !== "number") {
logger.error(
"[Drizzle Adapter] The result of the deleteMany operation is not a number. This is likely a bug in the adapter. Please report this issue to the Better Auth team.",
{ res, model, where },
);
}
return count;
},
options: config,
};

View File

@@ -196,6 +196,7 @@ export const callbackOAuth = createAuthEndpoint(
return redirectOnError("email_not_found");
}
console.log(`callbackOAuth - userInfo`, userInfo)
const result = await handleOAuthUserInfo(c, {
userInfo: {
...userInfo,

View File

@@ -771,8 +771,6 @@ export const genericOAuth = (options: GenericOAuthOptions) => {
}
throw ctx.redirect(toRedirectTo);
}
console.log(`genericOAuth - userInfo`, userInfo)
const result = await handleOAuthUserInfo(ctx, {
userInfo,
account: {