Skip to content

fix: correct read.js API calls in multi-author-blog guide#787

Open
NoahMaizels wants to merge 1 commit intomasterfrom
fix/multi-author-blog-read-js
Open

fix: correct read.js API calls in multi-author-blog guide#787
NoahMaizels wants to merge 1 commit intomasterfrom
fix/multi-author-blog-read-js

Conversation

@NoahMaizels
Copy link
Copy Markdown
Collaborator

Summary

Two bugs in the read.js code block of the Multi-Author Blog guide, found by running the code against a live Bee node:

  • reader.download()reader.downloadReference(): download() returns { payload, feedIndex, feedIndexNext } with no reference property. The code then passes indexResult.reference (which is undefined) to bee.downloadFile(), crashing immediately. downloadReference() returns { reference, feedIndex, feedIndexNext } as needed. Fixed in all three call sites.

  • authorsData.dataauthorsData.data.bytes: bee.downloadFile() returns data as a bee-js Bytes object, not a raw ArrayBuffer. Passing it directly to new TextDecoder().decode() throws ERR_INVALID_ARG_TYPE. The .bytes property exposes the underlying Buffer which TextDecoder accepts.

Test plan

  • Copy the fixed read.js into a project with a running Bee node, run node init.js, node add-post.js alice ..., node add-post.js bob ..., node update-index.js, then node read.js — should print index feed state, both authors, and homepage URL without errors

🤖 Generated with Claude Code

Two bugs in the read.js code block:

1. reader.download() returns { payload, feedIndex } with no reference
   property — replace with reader.downloadReference() which returns
   { reference, feedIndex } as needed by bee.downloadFile().

2. bee.downloadFile() returns data as a bee-js Bytes object, not an
   ArrayBuffer — new TextDecoder().decode(authorsData.data) throws;
   use authorsData.data.bytes to get the underlying Buffer.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 31, 2026

Deploy Preview for test-twitter-preview-testing-3 ready!

Name Link
🔨 Latest commit 8f4e618
🔍 Latest deploy log https://app.netlify.com/projects/test-twitter-preview-testing-3/deploys/69cb83636dd6a10008f154d4
😎 Deploy Preview https://deploy-preview-787--test-twitter-preview-testing-3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

1 participant