quickFastJoe
quickFastJoe
BABetter Auth
Created by quickFastJoe on 3/5/2025 in #help
How to handle database errors
2025-03-04T22:01:39.315Z ERROR [Better Auth]: error error: duplicate key value violates unique constraint "user_phoneNumber_key" at async POST (src/app/api/auth/[...all]/route.ts:8:14) at async POST (src/app/api/auth/[...all]/route.ts:8:14) 6 | 7 | export const POST = async (req: NextRequest) => {
8 | const res = await auth.handler(req);
| ^ 9 | return res; 10 | }; 11 | { length: 221, severity: 'ERROR', code: '23505', detail: 'Key ("phoneNumber")=(+1(phonenumber)) already exists.', hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: 'public', table: 'user', column: undefined, dataType: undefined, constraint: 'user_phoneNumber_key', file: 'nbtinsert.c', line: '666', routine: '_bt_check_unique' }
20 replies