Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Bizarre discrepancies between running ipfs.files.cat on images, videos, and text #959

Closed
bergutman opened this issue Aug 25, 2017 · 7 comments
Labels
exp/expert Having worked on the specific codebase is important kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up status/in-progress In progress

Comments

@bergutman
Copy link

  • Version: 0.25.0
  • Platform: ChromeOS Version 59.0.3071.134 (Official Build) (64-bit)
  • Subsystem: N/A

Type: Bug

Severity: High

Description:

When running js-ipfs in a browser I'm able to cat hashes that point to images or videos, but cannot seem to return hashes that point to text. All of these hashes are working just fine on the ipfs.io/ipfs gateway but only some of them seem to be working over js-ipfs. So far I'm pretty sure that the correlation has to do with file type, but I could be missing something obvious in my code. I won't pretend that I have a full understanding of this magical thing you've created. 🤔

Steps to reproduce the error:

I've created a codepen for this, but I'm having the same problem outside of codepen.
https://codepen.io/ConnorGutman/pen/yoxyJM

Using this pen the following hashes I've found from Reddit work:
Qmaegukzb1dLA7F4EfhXnF4s5JzpbsBQSK6VWDHP4sNXe2 (image)
QmYqtUPsXeY432KYEvs6fbAM3fUDrCfsgGSySRffckYPeV (image)
Qma3HGzDH9KXvyNTcVbrHtcjHubDHxyPEG8Xh7fRKJVqrH (image)
QmbAncBbxoTTcRn2FJy5qeuYU7ygfA5dTDrG89XBwSwtJq (video)
QmNcbqQkg7PemeTbhs7GchNwyx2CTcrEAD9cacbrAbxXXZ (video)
QmanVqtDfpEx3Fbdz5eRwJ3aNbSRCLTAiSDMLRHEP8hNCR (video)

The following text hashes do not work:
Qmc5gCcjYypU7y28oCALwfSvxCBskLuPKWpK4qpterKC7z
QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j
QmVDWmkM87NfR85WE1LvfwfJLRcMEtfNnCBiCJQRePP7Ly
QmdKUFBHQqYjGXgYkr5ViC9nbukmrEgXSgbb3LRTQ5dkCD

Again, not sure if this is a huge obvious noob-y failure of some sort on my end. I can't for the life of me seem to figure it out. Time for more coffee I guess! ☕️

Keep up the awesome work!

@daviddias
Copy link
Member

Hi @ConnorGutman! Thanks so much for reporting this and coming up with an example that made it so much easier for me to test, I really appreciate that :)

I've added a bit more stuff to your example and kept being stuck in the same issue that you are having: https://codepen.io/anon/pen/MvqEbq?editors=0001

It seems that it is an issue on Bitswap that we also detected on ipfs/js-ipfs-bitswap#142 (comment) and merged the PR recently. I still need to update the bitswap dependency here. Let me do that and lets try again then :)

@daviddias daviddias added kind/bug A bug in existing code (including security flaws) exp/expert Having worked on the specific codebase is important P1 High: Likely tackled by core team if no one steps up labels Aug 26, 2017
@daviddias
Copy link
Member

released 0.25.2, now waiting for codepen to clean its cache :)

https://codepen.io/daviddias/pen/MvqEbq
image

@bergutman
Copy link
Author

Hey @diasdavid, I'm glad you found the Codepen helpful and thank you for the amazing turnaround! I have updated my local package to 0.25.2 while waiting for unpkg to propagate the new release and everything seems to be working again! In fact, everything is loading super fast now:

itworks

As you can see it's almost instantaneous. 🎉🎉🎉

The only problem I'm still having with the app I'm working on is this:
QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j - “hello world!”
Qmc5gCcjYypU7y28oCALwfSvxCBskLuPKWpK4qpterKC7z - "Hello World!"

The first hash won't load but the second will, despite having nearly the same contents. 🤔

I'll give it a few more shots and poke around a bit. Otherwise, I think this issue is about ready to be marked as resolved!

Tangent: Congratulations to Protocol Labs on the recent ICO! IPFS rocks, and I'm really excited to see all of the amazing stuff that will come out of Filecoin. 👐

@daviddias
Copy link
Member

Woot! That's excellent! What is that app you are developing? Looks really cool!

To solve the outstanding issue, it would be excellent if you could create tests for js-ipfs that replicate the issue, it is the easiest way for us to be able to reproduce it and guarantee that the fix remains in place.

@daviddias daviddias added the status/in-progress In progress label Aug 28, 2017
@daviddias
Copy link
Member

@ConnorGutman shall I consider this one as fixed?

@bergutman
Copy link
Author

@diasdavid It appears that the issue with "Hello World!" vs "hello world!" resolved itself! Not sure what the problem was, but I suspect it was unrelated and probably nothing. Perhaps even as simple as one having more peers to download from or something. However, I'm unfortunately still having issues with unpkg. I've made a local copy of your Codepen and it's still having issues reaching 0.25.2 at https://unpkg.com/[email protected]/dist/index.min.js. Wondering if this is a bigger problem, as when I originally submitted this issue I was getting 0.25.0 from https://unpkg.com/ipfs/dist/index.min.js and not 0.25.1.

As for the test cases, I'm not sure I would be the best person for that 😅. My high-level understanding of js-ipfs is a little limited currently so I'm not sure what the best way to test for this would be. Are you talking about simply adding a test case which cats several different hashes with varying file types, or a test for something related to the issue in bitswap discussed at ipfs/js-ipfs-bitswap#142? Let me know if I can help somehow, and I'd love to contribute within my current abilities!

Side note: Thanks! The app I'm building is a blogging / messaging service built with Ethereum+IPFS. A smart contract handles user registration and stores hashes pointing to text on IPFS. When a user submits a post their followers automatically download it via IPFS and store it in a local pouchDB instance. The goal is that as content organically spreads, it is shared over different mediums by the initial subscribers and verified against the hash stored on the blockchain. If a post gets garbage collected on IPFS users can still request it from one another.

@daviddias
Copy link
Member

As for the test cases, I'm not sure I would be the best person for that 😅. My high-level understanding of js-ipfs is a little limited currently so I'm not sure what the best way to test for this would be.

No worries, it was an infrastructure change issue not a code issue. It will be fully fixed with #973. Closing this one, good luck with your app!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/expert Having worked on the specific codebase is important kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up status/in-progress In progress
Projects
None yet
Development

No branches or pull requests

2 participants