[PR #1736] [CLOSED] fix(auth): Ensure user role is saved on creation OIDC Bug Fix #1890

Closed
opened 2026-03-02 11:59:38 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/karakeep-app/karakeep/pull/1736
Author: @chaos-dotcom
Created: 7/13/2025
Status: Closed

Base: mainHead: main


📝 Commits (2)

  • dcfec7d fix: Save user role on creation
  • 536e554 Merge branch 'karakeep-app:main' into main

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 apps/web/server/auth.ts (+1 -0)

📄 Description

Problem:

When a new user registers using an OIDC/OAuth provider, their role was not being saved
to the database. This caused a TRPCError: User settings not found on subsequent
operations, as the logic to create default settings for a new user was failing. This
effectively broke the sign-up flow for new users.

Solution:

This change updates the custom createUser function in the next-auth adapter
configuration (apps/web/server/auth.ts). It now correctly passes the role from the user
profile object to the function responsible for creating the user record in the
database. This ensures the user is created with a role, allowing default settings to be
generated and resolving the error.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/karakeep-app/karakeep/pull/1736 **Author:** [@chaos-dotcom](https://github.com/chaos-dotcom) **Created:** 7/13/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (2) - [`dcfec7d`](https://github.com/karakeep-app/karakeep/commit/dcfec7d7d307bebf4b86176ce606b358adea9640) fix: Save user role on creation - [`536e554`](https://github.com/karakeep-app/karakeep/commit/536e55400baaed6f9cf3128969a9ff48d97abbb4) Merge branch 'karakeep-app:main' into main ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `apps/web/server/auth.ts` (+1 -0) </details> ### 📄 Description Problem: When a new user registers using an OIDC/OAuth provider, their role was not being saved to the database. This caused a TRPCError: User settings not found on subsequent operations, as the logic to create default settings for a new user was failing. This effectively broke the sign-up flow for new users. Solution: This change updates the custom createUser function in the next-auth adapter configuration (apps/web/server/auth.ts). It now correctly passes the role from the user profile object to the function responsible for creating the user record in the database. This ensures the user is created with a role, allowing default settings to be generated and resolving the error. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 11:59:38 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/karakeep#1890
No description provided.