Closed Yuripetusko closed 7 months ago
Unless the following check is invalid for some reason, hard to reproduce this case when car was not stored, to inspect the header
if (typeof carHeader.Metadata === "undefined" || typeof carHeader.Metadata['cid'] === "undefined") {
throw new Error(`No CID Returned from Remote`)
}
We use
storeBlob
to save JSON files to IPFS. Recently we had a case where several of our pins usingstoreBlob
returned CID but the file was not uploaded to bucket and not announced to DHT. We repinned the same content and it was eventually correctly uploaded to filebase s3 bucket and announced to DHT.When looking at code,
storeBlob
returns CID that is returned fromencodeBlob
, so there's no guarantee that it was actually uploaded, and my immediate reaction was that this is the cause of this issue, however, after closer inspection, I can see that on the next like there'sawait FilebaseClient.storeCar(service, car, objectName || cid.toString())
, which should throw and error if CID is not returned from filebase server, which shows immediately go tocatch
clause and callawait blockstore.close()
instead of returning CID.So I am puzzled how this happened that CID was returned but the file was not uploaded to the bucket, I was going to submit this simple fix (see screenshot below), but cannot understand why it would be needed as
storeCar
promise should throw if there's no CID returned incarHeader.Metadata['cid']