Skip to content

Commit 8064090

Browse files
author
Theodore Li
committed
Fix threshold
1 parent 9c99c3a commit 8064090

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,13 +334,14 @@ async function reportCompletion(
334334
// Next.js silently truncates request bodies beyond its body size limit (default 10MB),
335335
// corrupting the JSON and causing a server-side parse error (500). When the request fails
336336
// and the payload is large, retry without logs (the largest field) to fit under the limit.
337-
const LARGE_PAYLOAD_THRESHOLD = 1024 * 1024
338-
if (!res.ok && data && new Blob([body]).size > LARGE_PAYLOAD_THRESHOLD) {
337+
const LARGE_PAYLOAD_THRESHOLD = 10 * 1024 * 1024
338+
const bodySize = new Blob([body]).size
339+
if (!res.ok && data && bodySize > LARGE_PAYLOAD_THRESHOLD) {
339340
const { logs: _logs, ...dataWithoutLogs } = data
340341
logger.warn('[RunTool] reportCompletion failed with large payload, retrying without logs', {
341342
toolCallId,
342343
status: res.status,
343-
bodySize: new Blob([body]).size,
344+
bodySize,
344345
})
345346
const retryRes = await fetch(COPILOT_CONFIRM_API_PATH, {
346347
method: 'POST',

0 commit comments

Comments
 (0)