This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Uploaded file via Spawned Node not accessible via public gateway #886
Closed
Description
I'm building a deploy step for a simple JS app. My understanding of the steps required to propogate something to IPFS via the JS wrapper is:
1. Build App (via Webpack etc)
2. Create buffers / readable streams for built files
3. Spawn IPFS node via `let node = new IPFS()`
4. Upload files via `node.files.add`
Write now, the code is as follows:
let node;
return new RSVP.Promise(function(resolve, reject) {
node = new IPFS();
node.on('ready', () => {
// file here will eventually comprise a built web app
let file = new node.types.Buffer('/hello.txt');
node.files.add([{
path: '/hello.txt',
content: file
}], function(err, files) {
if (err) { return reject(err); }
return resolve(files);
});
});
}).finally(() => {
if (node) node.stop();
});
This resolves a hash successfully without throwing err
. However, when I navigate to
https://gateway.ipfs.io/ipfs/${files[0].hash}
, the file doesn't actually resolve.
What am I missing here?
I'm guessing that while the file has uploaded to the local node, it gets stopped before the file has propagated to a permanent node on the network. If that's correct, how do I know how to keep the local node alive long enough for it to propagate to the gateway?