From 34ceb6f5b40130cc3b283d9863083630f917bcf9 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sat, 24 Sep 2022 23:10:34 -0700 Subject: [PATCH] Fix infinite-hang bug in /api/uploadLayerImage Oops, Next.js has built-in request body parsing that happens automatically. So it was giving us a `req.body` string, and our code to read in the body and put it in a buffer was waiting forever! Thankfully, it's much easier than I expected to turn that behavior off for just one route. Now it works like before, so our existing code works again, ta da! --- pages/api/uploadLayerImage.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pages/api/uploadLayerImage.js b/pages/api/uploadLayerImage.js index a8bc488..96df34e 100644 --- a/pages/api/uploadLayerImage.js +++ b/pages/api/uploadLayerImage.js @@ -177,4 +177,10 @@ async function handleWithBeeline(req, res) { ); } +export const config = { + api: { + bodyParser: false, + }, +}; + export default handleWithBeeline;