Skip to content

Instantly share code, notes, and snippets.

@Jonahbkerr
Created February 12, 2026 17:26
Show Gist options
  • Select an option

  • Save Jonahbkerr/fabd7c704368b7b86a6ea51df42bc3b5 to your computer and use it in GitHub Desktop.

Select an option

Save Jonahbkerr/fabd7c704368b7b86a6ea51df42bc3b5 to your computer and use it in GitHub Desktop.
Debug: add version marker and raw admin value to /auth/user response
diff --git a/backend/src/db.ts b/backend/src/db.ts
index bc067d8..9fa21e9 100644
--- a/backend/src/db.ts
+++ b/backend/src/db.ts
@@ -6,7 +6,7 @@ const pool = new Pool({
connectionString: process.env.DATABASE_URL,
max: 20,
idleTimeoutMillis: 30000,
- connectionTimeoutMillis: 2000,
+ connectionTimeoutMillis: 10000,
});
pool.on('error', (err) => {
diff --git a/backend/src/routes/auth.ts b/backend/src/routes/auth.ts
index 2aef333..c9c3352 100644
--- a/backend/src/routes/auth.ts
+++ b/backend/src/routes/auth.ts
@@ -369,17 +369,8 @@ router.post(
router.get('/user', authenticate, async (req, res) => {
const authReq = req as unknown as AuthenticatedRequest;
- // Check if user is a platform admin
- let is_platform_admin = false;
- try {
- const adminCheck = await query(
- 'SELECT is_system_admin FROM users WHERE id = $1',
- [authReq.user!.id]
- );
- is_platform_admin = adminCheck.rows[0]?.is_system_admin === true;
- } catch {
- // Column may not exist yet
- }
+ // Check if user is a platform admin (already loaded by authenticate middleware)
+ const is_platform_admin = (authReq.user as any)?.is_system_admin === true;
// Load org context if user has an organization
let organization = null;
@@ -425,6 +416,8 @@ router.get('/user', authenticate, async (req, res) => {
name: authReq.user!.name,
avatar_url: authReq.user!.avatar_url,
is_platform_admin,
+ _debug_v: 2,
+ _debug_raw_admin: (authReq.user as any)?.is_system_admin,
organization,
needs_onboarding,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment