fix: fail-fast guard TELEGRAM_CHUNK_SIZE_BYTES <= 19MB (Telegram getFile limit 20MB)
Build & Deploy (Nix) / build-and-deploy (push) Successful in 56s
Build & Deploy (Nix) / build-and-deploy (push) Successful in 56s
Chunk parts > 19MB are stored to Telegram but getFile cannot resolve files over 20MB ('Bad Request: file is too big'), making every part undownloadable (prod bug 2026-08-01: 48MB chunk -> download 500).
- src/env.ts: reject TELEGRAM_CHUNK_SIZE_BYTES > 19922944 at startup (log error + throw), default changed 20MB -> 19MB
- src/shared/utils/validation.ts: TELEGRAM_CHUNK_SIZE_MAX_BYTES constant; asSafeChunkSize now enforces the max at runtime (covers S3 multipart parts too)
- test/env.test.ts: unit tests + subprocess fail-fast tests (48MB rejected, 19MB accepted)
- test/helpers/setup-env.ts: pin safe chunk size so a stale .env can't break the suite
- .env.example + CLAUDE.md: document the 20MB getFile limit
This commit is contained in:
+2
-2
@@ -16,8 +16,8 @@ RATE_LIMIT_MAX_REQUESTS=30
|
||||
# S3_VHOST_DOMAINS=upload.asepharyana.my.id,upload.asepharyana.web.id
|
||||
|
||||
# Telegram-safe internal chunking for large stored files
|
||||
# Telegram max upload ~49MB, using 48MB for safety
|
||||
# TELEGRAM_CHUNK_SIZE_BYTES=50331648
|
||||
# Telegram getFile download limit is 20 MB; guard rejects > 19922944 (19 MB)
|
||||
# TELEGRAM_CHUNK_SIZE_BYTES=19922944
|
||||
# COMPRESS_CHUNKED_UPLOADS=true
|
||||
# CHUNK_COMPRESSION_MIN_SIZE_BYTES=4096
|
||||
|
||||
|
||||
Reference in New Issue
Block a user