fix: increase Socket.IO maxHttpBufferSize to 300MB to support larger drafting payloads and prevent 413 errors.

This commit is contained in:
2025-12-17 15:33:02 +01:00
parent 4ff2eb0ef0
commit e5750d9729
3 changed files with 14 additions and 0 deletions

View File

@@ -77,3 +77,4 @@
- [Responsive Pack Grid Layout](./devlog/2025-12-17-142500_responsive_pack_grid.md): Completed. Implemented responsive multi-column grid for generated packs when card size is reduced (<25% slider).
- [Stack View Consistency Fix](./devlog/2025-12-17-143000_stack_view_consistency.md): Completed. Removed transparent overrides for Stack View, ensuring it renders with the standard unified container graphic.
- [Dynamic Pack Grid Layout](./devlog/2025-12-17-144000_dynamic_pack_grid.md): Completed. Implemented responsive CSS grid with `minmax(550px, 1fr)` for Stack/Grid views to auto-fit packs based on screen width without explicit column limits.
- [Fix Socket Payload Limit](./devlog/2025-12-17-152700_fix_socket_payload_limit.md): Completed. Increased Socket.IO `maxHttpBufferSize` to 300MB to support massive drafting payloads.

View File

@@ -0,0 +1,12 @@
# Fix Socket.IO Payload Limit
## Issue
The user reported a `413 (Payload Too Large)` error when creating a draft room with a full box of 36 packs. This was caused by the default `maxHttpBufferSize` limit (1MB) in Socket.IO, which is insufficient for the large JSON payload generated by 540 cards (36 packs * 15 cards) with full metadata.
## Resolution
- Modified `src/server/index.ts` to increase `maxHttpBufferSize` to 300MB (3e8 bytes).
- This explicitly sets the limit in the `Server` initialization options.
## Verification
- `tsx watch` should automatically restart the server.
- The new limit allows for massive payloads, covering the requirement for 36+ packs (requested >250MB).

View File

@@ -17,6 +17,7 @@ const __dirname = path.dirname(__filename);
const app = express();
const httpServer = createServer(app);
const io = new Server(httpServer, {
maxHttpBufferSize: 300 * 1024 * 1024, // 300MB
cors: {
origin: "*", // Adjust for production,
methods: ["GET", "POST"]