From 2823ed8612cb9797d43e847edac5e2bdc0fe7426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20S=C3=B3jko?= Date: Tue, 14 Nov 2023 14:07:55 +0100 Subject: [PATCH] fix(api-gateway): buffer encoding --- packages/api-gateway/bin/server.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/api-gateway/bin/server.ts b/packages/api-gateway/bin/server.ts index 766756ebf..0ee90bdf2 100644 --- a/packages/api-gateway/bin/server.ts +++ b/packages/api-gateway/bin/server.ts @@ -76,9 +76,9 @@ void container.load().then((container) => { app.use( json({ limit: '50mb', - verify: (_req: IncomingMessage, _res: ServerResponse, buf: Buffer, _encoding: string): void => { + verify: (_req: IncomingMessage, _res: ServerResponse, buf: Buffer, encoding: string): void => { try { - JSON.parse(buf.toString()) + JSON.parse(buf.toString(encoding as BufferEncoding)) } catch (error) { logger.error(`Invalid JSON: ${(error as Error).message}. Request body: ${buf.toString()}`) }