-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(nextjs-size-limit): surface 413s accurately #2265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryAdded comprehensive error handling for Next.js 10MB request body size limits to prevent truncated payloads and provide accurate 413 error reporting. Key Changes:
Implementation Approach:
Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client as Client/Executor
participant executeTool as executeTool()
participant handler as Request Handler
participant validate as validateRequestBodySize()
participant api as External/Internal API
Client->>executeTool: Call with toolId & params
executeTool->>handler: Route to handler (internal/proxy/mcp)
alt Before Request
handler->>validate: Check body size
validate->>validate: Calculate size with Blob API
alt Size > 10MB
validate-->>handler: throw Error(user-friendly message)
handler-->>executeTool: Return error response
executeTool-->>Client: Return ToolResponse with error
end
end
handler->>api: Send request
alt Response Status 413
api-->>handler: HTTP 413 Entity Too Large
handler->>handler: Check response.status === 413
handler-->>executeTool: throw Error(user-friendly message)
executeTool-->>Client: Return ToolResponse with error
end
alt Other Error
api-->>handler: Error response
handler->>handler: catch block
handler->>handler: handleBodySizeLimitError()
alt isBodySizeLimitError = true
handler-->>executeTool: throw Error(user-friendly message)
else Other error
handler-->>executeTool: Re-throw original error
end
executeTool-->>Client: Return ToolResponse with error
end
alt Success
api-->>handler: HTTP 200 OK
handler-->>executeTool: Return success response
executeTool-->>Client: Return ToolResponse with data
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 1 comment
Summary
Hitting a size limit error randomly truncates payload making error reporting ad hoc.
Type of Change
Testing
Tested with @aadamgough
Checklist