-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] 图片上传成功但数据库没记录 #3019
Comments
👀 @fushes Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. |
📦 EnvironmentDocker 📌 Version1.1.7 💻 Operating SystemWindows 🌐 BrowserEdge 🐛 Bug DescriptionI built a mirrored database version myself. After configuring S3, I can also upload pictures. However, an error will be reported when sending a message. After checking the database, I found that there is no record of uploaded files in the file table, resulting in an error in the foreign key constraint of the file_id field in the files_to_messages table. , I canceled the foreign key constraint and found that it could be sent normally and the AI could read the image normally. By reading the code, I found that the problem should occur in 📷 Recurrence StepsNo response 🚦 Expected BehaviorNo response 📝 Additional Information{"level":30,"time":1719257750186,"pid":1,"hostname":"f5b2310fb12f","msg":"Error in tRPC handler (lambda) on path: message.createMessage, type: mutation" } |
✅ @fushes This issue is closed, If you have any questions, you can comment and reply. |
📦 Environment
Docker
📌 Version
1.1.7
💻 Operating System
Windows
🌐 Browser
Edge
🐛 Bug Description
自己构建镜像了数据库版,配置好s3后也能够传图片,但是在发送消息的时候会报错,经过排查数据库发现file表中并没有上传文件的记录,导致files_to_messages表中的file_id字段外键约束报错,我取消外键约束后发现可以正常发送并且AI正常读取图片。通过阅读代码发现问题应该出现在
const result = await uploadService.uploadFile(fileItem); const data = await fileService.createFile(result);
是否考虑在中间几个判断:// 校验上传结果 if (!uploadResult || !uploadResult.fileId) { throw new Error('文件上传失败:' + uploadResult?.errorMessage); }
希望开发大大能复现这个bug📷 Recurrence Steps
No response
🚦 Expected Behavior
No response
📝 Additional Information
{"level":30,"time":1719257750186,"pid":1,"hostname":"f5b2310fb12f","msg":"Error in tRPC handler (lambda) on path: message.createMessage, type: mutation"}
error: insert or update on table "files_to_messages" violates foreign key constraint "files_to_messages_file_id_files_id_fk"
at /app/node_modules/.pnpm/[email protected]/node_modules/pg/lib/client.js:526:17
... 8 lines matching cause stack trace ...
at async r (/app/.next/server/chunks/89824.js:1:2169) {
code: 'INTERNAL_SERVER_ERROR',
name: 'TRPCError',
[cause]: error: insert or update on table "files_to_messages" violates foreign key constraint "files_to_messages_file_id_files_id_fk"
at /app/node_modules/.pnpm/[email protected]/node_modules/pg/lib/client.js:526:17
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /app/.next/server/app/trpc/lambda/[trpc]/route.js:4:12341
at async g.transaction (/app/.next/server/chunks/88811.js:27:9146)
at async /app/.next/server/app/trpc/lambda/[trpc]/route.js:4:14989
at async h.middlewares (/app/.next/server/chunks/89824.js:1:1895)
at async r (/app/.next/server/chunks/89824.js:1:2169)
at async r (/app/.next/server/chunks/89824.js:1:2169)
at async r (/app/.next/server/chunks/89824.js:1:2169)
at async r (/app/.next/server/chunks/89824.js:1:2169) {
length: 316,
severity: 'ERROR',
code: '23503',
detail: 'Key (file_id)=(file-VVoijxPw) is not present in table "files".',
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: 'public',
table: 'files_to_messages',
column: undefined,
dataType: undefined,
constraint: 'files_to_messages_file_id_files_id_fk',
file: 'ri_triggers.c',
line: '2608',
routine: 'ri_ReportViolation'
}
}
The text was updated successfully, but these errors were encountered: