From 9b01fbaf2f25e04d78029de25fe36a06e487e942 Mon Sep 17 00:00:00 2001 From: TtiPo Date: Fri, 19 Jun 2026 00:22:48 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=AF=B8=EC=A0=95=EC=9D=98=20=EC=98=88?= =?UTF-8?q?=EC=99=B8=20=EB=A1=9C=EA=B9=85=EC=97=90=EC=84=9C=20=EB=A9=94?= =?UTF-8?q?=EC=8B=9C=EC=A7=80=C2=B7=EC=8A=A4=ED=83=9D=20=EC=9C=A0=EC=8B=A4?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HttpException 이 아닌 예외를 Logger.error 두 번째 인자(스택 문자열 자리)에 Error 객체째로 넘겨, nest-winston 직렬화 과정에서 message/stack 이 사라지고 `{ stack: [ {} ] }` 로만 찍히던 문제를 수정. 메시지는 message 로, 스택은 문자열로 분리해 실제 원인이 로그에 남도록 한다. Co-Authored-By: Claude Opus 4.8 (1M context) --- backend/src/common/filters/http-exception.filter.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/src/common/filters/http-exception.filter.ts b/backend/src/common/filters/http-exception.filter.ts index 6297d7f..fdbec31 100644 --- a/backend/src/common/filters/http-exception.filter.ts +++ b/backend/src/common/filters/http-exception.filter.ts @@ -63,7 +63,15 @@ export class HttpExceptionFilter implements ExceptionFilter { } } else { // 정의되지 않은 예외 → 운영팀이 추적 가능하도록 로그 + SYS_001 응답 유지 - this.logger.error('Unhandled Exception', exception as Error); + // NestJS Logger 2번째 인자는 "스택 문자열"이어야 한다. Error 객체를 그대로 넘기면 + // nest-winston 이 비열거 속성을 직렬화하며 메시지/스택을 잃어 `{ stack: [ {} ] }` 로 찍힌다. + // → 메시지는 message 로, 스택은 문자열로 분리해 실제 원인이 로그에 남도록 한다. + const message = + exception instanceof Error ? exception.message : String(exception); + this.logger.error( + `Unhandled Exception: ${message}`, + exception instanceof Error ? exception.stack : undefined, + ); } response.status(status).json({