Skip to content

Commit 38d46e6

Browse files
author
Theodore Li
committed
Add const
1 parent f31181d commit 38d46e6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apps/sim/lib/copilot/client-sse/run-tool-execution.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,11 @@ async function reportCompletion(
331331
headers: { 'Content-Type': 'application/json' },
332332
body,
333333
})
334-
if (!res.ok && data && new Blob([body]).size > 1024 * 1024) {
334+
// Next.js silently truncates request bodies beyond its body size limit (default 10MB),
335+
// corrupting the JSON and causing a server-side parse error (500). When the request fails
336+
// and the payload is large, retry without the data to unblock the server-side waiter.
337+
const LARGE_PAYLOAD_THRESHOLD = 1024 * 1024
338+
if (!res.ok && data && new Blob([body]).size > LARGE_PAYLOAD_THRESHOLD) {
335339
logger.warn('[RunTool] reportCompletion failed with large payload, retrying without data', {
336340
toolCallId,
337341
status: res.status,

0 commit comments

Comments
 (0)