From 0195635f24200da1bb10cfb1e7d17b22463e9ca5 Mon Sep 17 00:00:00 2001 From: NoahMaizels Date: Mon, 30 Mar 2026 15:47:22 +0700 Subject: [PATCH] fix: add timing delay in script-02 between feed write and read After writer.upload() stores a feed SOC chunk, the Bee node needs a brief moment to index it before reader.downloadReference() can find it. Without this delay the script fails immediately with a 404 "lookup at failed" error. Co-Authored-By: Claude Sonnet 4.6 --- dynamic-content/script-02.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dynamic-content/script-02.js b/dynamic-content/script-02.js index 638f7ed..d57fcbd 100644 --- a/dynamic-content/script-02.js +++ b/dynamic-content/script-02.js @@ -39,6 +39,9 @@ const writer = bee.makeFeedWriter(topic, pk); await writer.upload(batchId, upload.reference); console.log("Feed updated at index 0"); +// Brief pause to allow the node to index the feed chunk +await new Promise((r) => setTimeout(r, 1000)); + // Read the latest reference from the feed const reader = bee.makeFeedReader(topic, owner); const result = await reader.downloadReference(); @@ -55,6 +58,9 @@ console.log("\nNew content hash:", upload2.reference.toHex()); await writer.upload(batchId, upload2.reference); console.log("Feed updated at index 1"); +// Brief pause to allow the node to index the feed chunk +await new Promise((r) => setTimeout(r, 1000)); + // Reading the feed now returns the updated reference const result2 = await reader.downloadReference(); console.log("Latest reference:", result2.reference.toHex());