Skip to content

Body Parser Limit (10KB) May Be Too Restrictive #360

Description

@icancodefyi

Priority: Medium
Category: Bug
Files: server/index.js:98

Description

The Express JSON body parser is configured with a 10KB limit:

app.use(express.json({ limit: "10kb" }));

This applies globally to ALL endpoints. Several operations could exceed 10KB:

  • Profile updates with multiple addresses, each with multiple fields
  • Bug reports containing long descriptions and data URLs
  • Bulk product operations
  • Order creation with many items

When the limit is exceeded, Express returns a 413 Payload Too Large error without any custom error handling.

Impact

  • Users with multiple addresses may fail to save their profile
  • Bug reports with detailed descriptions may be rejected
  • Poor error messaging — Express returns a raw 413 without the app's error format

Recommendation

  1. Increase the limit to a reasonable value (e.g., 1mb or 5mb)
  2. Add error handling middleware for SyntaxError and PayloadTooLargeError to return user-friendly messages
  3. Consider using different limits for different route groups if needed

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomersrefactorImprove code without changing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions