diff --git a/src/apiGateway.ts b/src/apiGateway.ts index c3b52e4..6c69703 100644 --- a/src/apiGateway.ts +++ b/src/apiGateway.ts @@ -34,7 +34,7 @@ export function httpRequestToEvent(request: Request): APIGatewayProxyEventV2 { } ); - const bodyString = request.body.toString('utf8'); + const bodyString = Buffer.isBuffer(request.body) ? request.body.toString('utf8') : ''; const shouldSendBase64 = request.method === 'GET' ? false : bodyString.includes('Content-Disposition: form-data'); const cookies = request.headers.cookie ? request.headers.cookie.split('; ') : [];