#7103 🐛 BUG: When using a long string (more than 1192 chars) the output is broken into several chunks splitted by new lines
Valid bug caused by miniflare's readline-based stdout handling. Root cause documented in #4357. Affects DB queries (Neon), not just console output. No fix merged.
Link to #4357; prioritize fix due to real-world application impact
Analysis Report
Issue Review: cloudflare/workers-sdk#7103
Summary
Long strings (>1192 chars) in console.log output are broken into multiple lines due to miniflare's readline-based stdout handling.
Findings
- Created: 2024-10-25
- Updated: 2026-01-12
- Version: wrangler 3.60.3 → 4.60.0 (major version upgrade since report)
- Component: wrangler / miniflare
- Labels: bug
- Comments: 2 (maintainer response + reporter follow-up)
Key Evidence
Root Cause Identified: The issue is in miniflare's
pipeOutputfunction atpackages/miniflare/src/runtime/index.ts. It usesrl.createInterface(stdout).on("line", ...)which splits output by newlines in the buffer - not actual newlines in the content:rl.createInterface(stdout).on("line", (data) => console.log(data));Known Issue: This exact problem is documented in issue #4357 "[Miniflare 3] Problems with the new logs" opened 2023-10-30 by Shopify (for Hydrogen CLI). That issue explicitly identifies:
- Each string line is logged in its own
console.logcall - The readline module pipes logs line-by-line based on buffer boundaries, not content
- Suggested fix: use
.on("data")instead of readline
- Each string line is logged in its own
Reporter Confirmed Real-World Impact: The reporter confirmed this causes actual failures when sending long database queries (Neon DB) - the query breaks due to unexpected line breaks being inserted.
No Fix Found:
- No PR explicitly fixes issue #7103
- Issue #4357 (the parent issue describing this architectural problem) remains open
- Changelog does not mention this fix
Not Fixed in Current Version: The miniflare runtime source still uses the readline approach as of the latest codebase.
Recommendation
Status: KEEP OPEN
Reasoning: This is a valid, confirmed bug with real-world impact. The root cause has been identified and is documented in related issue #4357. The reporter confirmed this affects database queries (Neon DB), not just console output display. The underlying issue in miniflare's pipeOutput function has not been addressed.
Action:
- Link this issue to #4357 as a duplicate or related issue
- Consider prioritizing a fix since it affects actual application behavior (database queries), not just logging aesthetics
- Potential fix: Replace readline-based approach with data event handling, or implement proper buffering
Suggested Comment
This issue is related to #4357 which documents the architectural problem in miniflare's log handling. The
pipeOutputfunction usesrl.createInterface().on("line")which splits output based on buffer boundaries rather than actual newlines in the content.Since this affects actual application behavior (breaking database queries as you mentioned with Neon DB), not just console output display, we're keeping this open. Linking to #4357 for tracking the underlying fix.
Notes & Feedback (0)
No notes yet.