SAML SSO Sign In 200, but getting server error due to null violations of user table

POST /api/auth/sign-in/sso 200 in 141ms
GET /api/auth/get-session 200 in 68ms
SERVER_ERROR: [error: null value in column "name" of relation "users" violates not-null constraint] {
length: 302,
severity: 'ERROR',
code: '23502',
detail: 'Failing row contains (osenRLx5jBCB7lmJwcIbyB0pJo7mL9Il, null, null, null, t, null, 2025-07-21 17:15:47.092, 2025-07-21 17:15:47.092, f, null).',
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: 'auth',
table: 'users',
column: 'name',
dataType: undefined,
constraint: undefined,
file: 'execMain.c',
line: '1982',
routine: 'ExecConstraints'
}
POST /api/auth/sso/saml2/callback/<orgslug>-saml 500 in 168ms
Solution
submitted a pr to fix the issue i have come across:

https://github.com/better-auth/better-auth/pull/3548
GitHub
This PR fixes an issue where the mapping object provided during registerSSOProvider is not persisted for SAML providers. This causes all attribute mappings to resolve as undefined during the SAML l...
Was this page helpful?