feat(server): log http exceptions (#9996)

This commit is contained in:
Jason Rasmussen 2024-06-05 17:07:47 -04:00 committed by GitHub
parent ce985ef8f8
commit 0f976edf96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 91 additions and 18 deletions

View file

@ -6,6 +6,7 @@ import { Request, Response } from 'express';
import { RedisOptions } from 'ioredis';
import Joi from 'joi';
import { CLS_ID, ClsModuleOptions } from 'nestjs-cls';
import { ImmichHeader } from 'src/dtos/auth.dto';
import { ConcurrentQueueName, QueueName } from 'src/interfaces/job.interface';
export enum TranscodePolicy {
@ -419,11 +420,11 @@ export const clsConfig: ClsModuleOptions = {
mount: true,
generateId: true,
setup: (cls, req: Request, res: Response) => {
const headerValues = req.headers['x-immich-cid'];
const headerValues = req.headers[ImmichHeader.CID];
const headerValue = Array.isArray(headerValues) ? headerValues[0] : headerValues;
const cid = headerValue || cls.get(CLS_ID);
cls.set(CLS_ID, cid);
res.header('x-immich-cid', cid);
res.header(ImmichHeader.CID, cid);
},
},
};