mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: add server-side logging to AI tool routes (#23)
AI routes (remove-background, erase-object, ocr, blur-faces, upscale) were silently swallowing errors - failures returned HTTP 422 to the client but never appeared in server logs. This made it impossible for self-hosters to diagnose issues like 504 timeouts from reverse proxies. Adds request.log.info() at processing start (tool name, image size, key settings) and request.log.error() in catch blocks, matching the existing tool-factory pattern. Co-authored-by: Siddharth Kumar Sah <siddharth123sk@gmail.com>
This commit is contained in:
committed by
GitHub
co-authored by
Siddharth Kumar Sah
parent
9e9a22cdd1
commit
75c7f135fe
@@ -55,6 +55,15 @@ export function registerBlurFaces(app: FastifyInstance) {
|
||||
|
||||
try {
|
||||
const settings = settingsRaw ? JSON.parse(settingsRaw) : {};
|
||||
request.log.info(
|
||||
{
|
||||
toolId: "blur-faces",
|
||||
imageSize: fileBuffer.length,
|
||||
blurRadius: settings.blurRadius,
|
||||
sensitivity: settings.sensitivity,
|
||||
},
|
||||
"Starting face blur",
|
||||
);
|
||||
|
||||
// Auto-orient to fix EXIF rotation before face detection
|
||||
fileBuffer = await autoOrient(fileBuffer);
|
||||
@@ -111,6 +120,7 @@ export function registerBlurFaces(app: FastifyInstance) {
|
||||
faces: result.faces,
|
||||
});
|
||||
} catch (err) {
|
||||
request.log.error({ err, toolId: "blur-faces" }, "Face blur failed");
|
||||
return reply.status(422).send({
|
||||
error: "Face blur failed",
|
||||
details: err instanceof Error ? err.message : "Unknown error",
|
||||
|
||||
Reference in New Issue
Block a user