Commit 7927339
committed
fix: map Convex table names to Better Auth model keys in isUniqueField
Fixes a bug where isUniqueField tries to access the Better Auth schema
using Convex table names (e.g., "users") directly, but the schema object
uses Better Auth's internal model names as keys (e.g., "user").
This causes the error: "Cannot read properties of undefined (reading 'fields')"
The fix maps Convex table names to Better Auth internal model names by
finding the key where betterAuthSchema[key].modelName === model, ensuring
compatibility with custom modelName values in Better Auth configuration.1 parent 753d7e0 commit 7927339
1 file changed
+11
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
69 | 75 | | |
70 | 76 | | |
71 | 77 | | |
72 | | - | |
| 78 | + | |
73 | 79 | | |
74 | 80 | | |
75 | 81 | | |
| |||
0 commit comments