From cc149e2f46024b081a2c6b695e64089eb57cfe6f Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 26 Feb 2023 17:12:15 +0900 Subject: [PATCH] =?UTF-8?q?fix(server):=20=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E3=81=AE=E3=82=B9=E3=82=BF=E3=83=83=E3=82=AF=E3=83=88=E3=83=AC?= =?UTF-8?q?=E3=83=BC=E3=82=B9=E3=81=AF=E8=BF=94=E3=81=95=E3=81=AA=E3=81=84?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #10064 --- CHANGELOG.md | 1 + packages/backend/src/server/api/ApiCallService.ts | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebc776243c..a6a90b39f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ You should also include the user name that made the change. - fix(client): Android ChromeでPWAとしてインストールできない問題を修正 - 未知のユーザーが deleteActor されたら処理をスキップする - fix(server): notes/createで、fileIdsと見つかったファイルの数が異なる場合はエラーにする +- fix(server): エラーのスタックトレースは返さないように ## 13.7.5 (2023/02/24) diff --git a/packages/backend/src/server/api/ApiCallService.ts b/packages/backend/src/server/api/ApiCallService.ts index 347fa59d36..6d8540dd4f 100644 --- a/packages/backend/src/server/api/ApiCallService.ts +++ b/packages/backend/src/server/api/ApiCallService.ts @@ -2,6 +2,7 @@ import { pipeline } from 'node:stream'; import * as fs from 'node:fs'; import { promisify } from 'node:util'; import { Inject, Injectable } from '@nestjs/common'; +import { v4 as uuid } from 'uuid'; import { DI } from '@/di-symbols.js'; import { getIpHash } from '@/misc/get-ip-hash.js'; import type { LocalUser, User } from '@/models/entities/User.js'; @@ -320,6 +321,7 @@ export class ApiCallService implements OnApplicationShutdown { if (err instanceof ApiError) { throw err; } else { + const errId = uuid(); this.logger.error(`Internal error occurred in ${ep.name}: ${err.message}`, { ep: ep.name, ps: data, @@ -327,14 +329,15 @@ export class ApiCallService implements OnApplicationShutdown { message: err.message, code: err.name, stack: err.stack, + id: errId, }, }); - console.error(err); + console.error(err, errId); throw new ApiError(null, { e: { message: err.message, code: err.name, - stack: err.stack, + id: errId, }, }); }