#143 Add request body size limit per route override FIXED#255
Merged
greatest0fallt1me merged 5 commits intoJun 29, 2026
Conversation
|
@veloura-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
Author
|
PLEASE REVIEW AND PING ME |
Contributor
Author
|
@greatest0fallt1me pls review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Key Findings
256kblimit.Fix Features
src/middleware/bodyLimit.ts.createBodyLimitMiddleware(...)DEFAULT_BODY_LIMIT = "256kb"WEBHOOK_BODY_LIMIT = "1mb"413src/index.ts:/api/admin/webhooksgets1mb256kbtests/bodyLimit.test.tscovering:README.mdwith request body size limit documentation.REPORT
Summary
Implemented a route-aware request body size limit solution for the backend.
This change:
256kb1mboverride for webhook-related routes413 Payload Too LargeresponsesIssue Addressed
The codebase previously used:
That prevented route-specific body size overrides and lacked a reusable middleware abstraction for per-route body-size control.
What Was Implemented
1. New middleware
Created:
src/middleware/bodyLimit.tsFeatures:
createBodyLimitMiddleware(...)DEFAULT_BODY_LIMIT = "256kb"WEBHOOK_BODY_LIMIT = "1mb"entity.too.largeparser errors into standardized app errors2. App wiring update
Updated:
src/index.tsChanges:
Applied routing:
/api/admin/webhooks→1mb256kb3. Tests added
Created:
tests/bodyLimit.test.tsCoverage includes:
4131mb4. Documentation updated
Updated:
README.mdAdded:
413response behaviorValidation Performed
Targeted test run
npm test -- --runInBand tests/bodyLimit.test.tsResult:
Build/test/lint attempt
Commands attempted:
npm run build npm run lint npm test -- --runInBandResult:
Examples:
src/db/indexerRepository.tssrc/routes/adminWebhooks.tssrc/services/drizzleWebhookStore.tssrc/services/marketEventsStream.tssrc/services/marketResolutionService.tssrc/workers/indexer.tsThese failures are outside the scope of the body-size fix.
Acceptance Criteria Status
413returned on exceed: DoneConfidence
Files Changed
Modified
src/index.tsREADME.mdCreated
src/middleware/bodyLimit.tstests/bodyLimit.test.tsSuggested Commit Message
CLOSE #143