mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-19 13:08:23 +02:00
Fix user creation errors by handling empty emails properly
Adjust user creation schema to allow null emails, update data handling to convert empty strings to null, and provide a SQL script to clean up existing duplicate empty email entries, resolving the `users_email_key` constraint violation. Replit-Commit-Author: Agent Replit-Commit-Session-Id: a8a78c07-e900-425c-a577-5b4c5894379d Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a8a78c07-e900-425c-a577-5b4c5894379d/aiHrulP
This commit is contained in:
1 parent
b886f317ca
commit
c77ea88e9d
5 files changed
+244
-4
No files matched your search
+201
@@ -0,0 +1,201 @@
|
||||
|
||||
|
||||
group_created_at: '2025-07-22 11:09:08.977622',
|
||||
|
||||
group_updated_at: '2025-07-28 18:25:49.452346'
|
||||
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
✅ Processed 1 groups for user _1753266816257
|
||||
|
||||
🔐 API /api/users - Returning: { isArray: true, length: 7, totalGroups: 6 }
|
||||
|
||||
GET /api/users 304 in 81ms
|
||||
|
||||
HEAD /api/health 200 in 1ms
|
||||
|
||||
🔍 getUserWithGroups called for user: admin_local
|
||||
|
||||
🔍 Querying user_groups for user: admin_local
|
||||
|
||||
🔍 Found 0 group assignments for user admin_local
|
||||
|
||||
🔍 Raw query result: []
|
||||
|
||||
✅ Processed 0 groups for user admin_local
|
||||
|
||||
🔍 getUserWithGroups called for user: admin_local
|
||||
|
||||
🔍 Querying user_groups for user: admin_local
|
||||
|
||||
🔍 Found 0 group assignments for user admin_local
|
||||
|
||||
🔍 Raw query result: []
|
||||
|
||||
✅ Processed 0 groups for user admin_local
|
||||
|
||||
🔍 POST /api/users - Creating new user
|
||||
|
||||
📥 Request body: {
|
||||
|
||||
"email": "",
|
||||
|
||||
"firstName": "",
|
||||
|
||||
"lastName": "",
|
||||
|
||||
"username": "ff292m",
|
||||
|
||||
"password": "ff292m",
|
||||
|
||||
"role": "manager",
|
||||
|
||||
"id": "_1754942821925"
|
||||
|
||||
}
|
||||
|
||||
🔍 getUserWithGroups called for user: admin_local
|
||||
|
||||
🔍 Querying user_groups for user: admin_local
|
||||
|
||||
🔍 Found 0 group assignments for user admin_local
|
||||
|
||||
🔍 Raw query result: []
|
||||
|
||||
✅ Processed 0 groups for user admin_local
|
||||
|
||||
🔍 Parsing user data...
|
||||
|
||||
✅ User data parsed successfully
|
||||
|
||||
🔒 Hashing password...
|
||||
|
||||
✅ Password hashed successfully
|
||||
|
||||
🔍 Generated user ID: _1754942821925
|
||||
|
||||
🔍 Creating user in database...
|
||||
|
||||
🔍 Storage createUser called with: ff292m
|
||||
|
||||
❌ Storage createUser error: error: duplicate key value violates unique constraint "users_email_key"
|
||||
|
||||
at /app/node_modules/pg-pool/index.js:45:11
|
||||
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
|
||||
|
||||
at async file:///app/node_modules/drizzle-orm/node-postgres/session.js:83:22
|
||||
|
||||
at async DatabaseStorage.createUser (file:///app/dist/index.js:989:26)
|
||||
|
||||
at async file:///app/dist/index.js:3993:23 {
|
||||
|
||||
length: 192,
|
||||
|
||||
severity: 'ERROR',
|
||||
|
||||
code: '23505',
|
||||
|
||||
detail: 'Key (email)=() already exists.',
|
||||
|
||||
hint: undefined,
|
||||
|
||||
position: undefined,
|
||||
|
||||
internalPosition: undefined,
|
||||
|
||||
internalQuery: undefined,
|
||||
|
||||
where: undefined,
|
||||
|
||||
schema: 'public',
|
||||
|
||||
table: 'users',
|
||||
|
||||
column: undefined,
|
||||
|
||||
dataType: undefined,
|
||||
|
||||
constraint: 'users_email_key',
|
||||
|
||||
file: 'nbtinsert.c',
|
||||
|
||||
line: '664',
|
||||
|
||||
routine: '_bt_check_unique'
|
||||
|
||||
}
|
||||
|
||||
❌ Storage error code: 23505
|
||||
|
||||
❌ Storage error constraint: users_email_key
|
||||
|
||||
❌ Error creating user: error: duplicate key value violates unique constraint "users_email_key"
|
||||
|
||||
at /app/node_modules/pg-pool/index.js:45:11
|
||||
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
|
||||
|
||||
at async file:///app/node_modules/drizzle-orm/node-postgres/session.js:83:22
|
||||
|
||||
at async DatabaseStorage.createUser (file:///app/dist/index.js:989:26)
|
||||
|
||||
at async file:///app/dist/index.js:3993:23 {
|
||||
|
||||
length: 192,
|
||||
|
||||
severity: 'ERROR',
|
||||
|
||||
code: '23505',
|
||||
|
||||
detail: 'Key (email)=() already exists.',
|
||||
|
||||
hint: undefined,
|
||||
|
||||
position: undefined,
|
||||
|
||||
internalPosition: undefined,
|
||||
|
||||
internalQuery: undefined,
|
||||
|
||||
where: undefined,
|
||||
|
||||
schema: 'public',
|
||||
|
||||
table: 'users',
|
||||
|
||||
column: undefined,
|
||||
|
||||
dataType: undefined,
|
||||
|
||||
constraint: 'users_email_key',
|
||||
|
||||
file: 'nbtinsert.c',
|
||||
|
||||
line: '664',
|
||||
|
||||
routine: '_bt_check_unique'
|
||||
|
||||
}
|
||||
|
||||
❌ Error type: DatabaseError
|
||||
|
||||
❌ Error code: 23505
|
||||
|
||||
❌ Error constraint: users_email_key
|
||||
|
||||
❌ Error stack: error: duplicate key value violates unique constraint "users_email_key"
|
||||
|
||||
at /app/node_modules/pg-pool/index.js:45:11
|
||||
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
|
||||
|
||||
at async file:///app/node_modules/drizzle-orm/node-postgres/session.js:83:22
|
||||
|
||||
at async DatabaseStorage.createUser (file:///app/dist/index.js:989:26)
|
||||
|
||||
at async file:///app/dist/index.js:3993:23
|
||||
|
||||
POST /api/users 409 in 109ms
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 311 KiB |
Reference in new issue
Block a user