fix(api): wrap encryptSecret in try/catch to return proper JSON error (GRO-441) #221

Merged
groombook-engineer[bot] merged 3 commits from fix/gro-441-auth-provider-500 into main 2026-04-04 00:24:40 +00:00

3 Commits

Author SHA1 Message Date
Flea Flicker 2453e3a0ae fix(db): remove duplicate encryptSecret/decryptSecret exports
Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-04 00:03:48 +00:00
Flea Flicker f37cf16b1f fix(api): export reinitAuth from lib/auth.ts
reinitAuth was imported by authProvider.ts but never defined.
Added a stub implementation that resolves immediately — proper
restart mechanism is tracked in GRO-390.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-04 00:02:35 +00:00
Flea Flicker 1c502bb165 fix(api): wrap encryptSecret in try/catch to return proper JSON error
PUT /api/admin/auth-provider was returning HTTP 500 with an HTML error page
when BETTER_AUTH_SECRET was missing, because encryptSecret() throws an
unhandled error. This change wraps both the encryption step and the DB
transaction in try/catch blocks to return a proper JSON error response.

Also adds the missing authProviderConfig schema and encryptSecret crypto
helpers from the feat/gro-392-oobe-auth-provider-bootstrap branch.

Fixes: GRO-441

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-04 00:02:11 +00:00