Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Commit 27a2b86

Browse files
committed
🐛 fix(buffer in body): request body would not get parsed by nextjs
Coming from ApiGateway, the request.body would be parsed as Buffer, this is not sustainable for parsing by NextJS into correct type - application/json. For this reason, we need to delete parsed body and let nextjs do it's thing afterwards.
1 parent c8565a1 commit 27a2b86

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/server-handler/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ const server = slsHttp(
4242
binary: true,
4343
provider: 'aws',
4444
basePath: process.env.NEXTJS_LAMBDA_BASE_PATH,
45+
request: (request: any) => {
46+
/*
47+
See following for more details:
48+
https://github.com/jetbridge/cdk-nextjs/pull/33/files
49+
https://github.com/dougmoscrop/serverless-http/issues/227
50+
*/
51+
delete request.body
52+
},
4553
},
4654
)
4755

0 commit comments

Comments
 (0)