Skip to content

fix: document turbot download body.on streaming bug and workaround (#63)#64

Open
vkumbha wants to merge 1 commit into
masterfrom
fix/download-readable-stream-web-api
Open

fix: document turbot download body.on streaming bug and workaround (#63)#64
vkumbha wants to merge 1 commit into
masterfrom
fix/download-readable-stream-web-api

Conversation

@vkumbha
Copy link
Copy Markdown

@vkumbha vkumbha commented May 25, 2026

Summary

  • Documents the turbot download failure (body.on is not a function) affecting v1.32.x and v1.33.x in a new Troubleshooting section of the README
  • Provides a NODE_OPTIONS workaround so users can download mods immediately without waiting for a CLI patch
  • Includes the exact one-liner source fix (Readable.fromWeb()) for CLI maintainers to apply in the private source repo

Root Cause (for CLI maintainers)

The download implementation calls .on('data', ...) on the response body returned by native fetch(). In Node.js 18+, fetch() returns a Web ReadableStream (which has no .on()), not the Node.js stream.Readable that node-fetch used to return. The fix is a one-liner:

// Before:
const re = await fetch(url);
re.body.on('data', chunk => fileStream.write(chunk));  // ❌ TypeError

// After:
import { Readable } from 'node:stream';
import { pipeline } from 'node:stream/promises';
const re = await fetch(url);
await pipeline(Readable.fromWeb(re.body), fileStream);  // ✅

Test plan

  • Verified bug reproduction on CLI v1.32.0-rc.1 and v1.33.0-rc.8 (Darwin/amd64)
  • Confirmed NODE_OPTIONS workaround successfully captures the S3 URL and curl downloads the zip
  • Confirmed downloaded zip (@turbot/aws-lambda@5.19.1, 39 MB) is valid and deploys successfully via turbot up --zip-file

Closes #63

🤖 Generated with Claude Code

Documents the Web ReadableStream vs Node.js Readable mismatch that
causes `turbot download` to fail in v1.32.x and v1.33.x, includes a
NODE_OPTIONS workaround for affected users, and shows the one-line
Readable.fromWeb() fix for CLI maintainers.

Fixes #63

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

turbot download fails with 'body.on is not a function' on Node.js 18+ (Web ReadableStream vs Node.js Readable mismatch)

1 participant