Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help wanted for react native v0.64 #1

Open
ravi0the0sun opened this issue Jun 29, 2021 · 12 comments
Open

Help wanted for react native v0.64 #1

ravi0the0sun opened this issue Jun 29, 2021 · 12 comments

Comments

@ravi0the0sun
Copy link

ravi0the0sun commented Jun 29, 2021

React Native Version

0.64.1

IPFS HTTP Client version

^50.1.1

Platform

IOS

Hi there, when i try to use add function it give an error of

 ERROR  Demo App .add string {"error": [TypeError: Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.]}

Example of code

const addString = async (client) => {
  console.log('Demo App .add string start');

  const file = {
    path: '/tmp/rn-ipfs-add-string',
    content: '邑中陽裏人也,姓劉氏。母媼嘗息大澤之陂,夢與神遇',
  };
  try {
    console.log('Demo App .add string', {
      result: inspect(await client.add(file)),
    });
  } catch (error) {
    console.error('Demo App .add string', {error});
  }
};

More info of enviroment

System:
    OS: macOS 10.15.7
    CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
    Memory: 8.51 GB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.17.0 - /var/folders/nf/83z965450dd46qzdlrd86t6h0000gn/T/fnm_multishells/892_1624954243867/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.13 - /var/folders/nf/83z965450dd46qzdlrd86t6h0000gn/T/fnm_multishells/892_1624954243867/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.2, DriverKit 19.0, macOS 10.15, tvOS 14.2, watchOS 7.1
    Android SDK:
      API Levels: 23, 27, 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.2
      System Images: android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom_64, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom_64, android-30 | Google Play Intel x86 Atom_64
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7042882
    Xcode: 12.1.1/12A7605b - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: ^0.64.1 => 0.64.1 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
@acostalima
Copy link
Collaborator

@ravi0the0sun, sorry for the late reply. You're using HTTP client v50.1.1 while the demo is currently using v48.2.0. Did you check whether breaking changes were introduced between v48 and v50?

@ravi0the0sun
Copy link
Author

Thanks for replying @acostalima i tried out a demo app with the v48.2.0 but the error still exist i think its because of the react native version.
Demo app dependencies

"dependencies": {
    "base-64": "^1.0.0",
    "ipfs-http-client": "^48.2.0",
    "multiaddr": "^10.0.0",
    "react": "17.0.1",
    "react-native": "0.64.2",
    "react-native-fetch-api": "^2.0.0",
    "react-native-get-random-values": "^1.7.0",
    "react-native-polyfill-globals": "^3.1.0",
    "react-native-url-polyfill": "^1.3.0",
    "text-encoding": "^0.7.0",
    "util": "^0.12.4",
    "web-streams-polyfill": "^3.0.3"
  },

@acostalima
Copy link
Collaborator

acostalima commented Jul 30, 2021

@ravi0the0sun I don't know when I'll have the chance to look into this. Meanwhile, feel free to dig deeper and create a PR if you manage to fix the issue. Thanks!

@jcoulaud
Copy link

jcoulaud commented Dec 4, 2021

Thanks for replying @acostalima i tried out a demo app with the v48.2.0 but the error still exist i think its because of the react native version. Demo app dependencies

"dependencies": {
    "base-64": "^1.0.0",
    "ipfs-http-client": "^48.2.0",
    "multiaddr": "^10.0.0",
    "react": "17.0.1",
    "react-native": "0.64.2",
    "react-native-fetch-api": "^2.0.0",
    "react-native-get-random-values": "^1.7.0",
    "react-native-polyfill-globals": "^3.1.0",
    "react-native-url-polyfill": "^1.3.0",
    "text-encoding": "^0.7.0",
    "util": "^0.12.4",
    "web-streams-polyfill": "^3.0.3"
  },

Did you find a solution?

@acostalima
Copy link
Collaborator

acostalima commented Dec 6, 2021

@jcoulaud try to let the error bubble up to see if you can get a stack trace...

@jcoulaud
Copy link

jcoulaud commented Dec 7, 2021

@acostalima, I can't find any, unfortunately. It's a bit of a generic error that does not lead to anything. What was yours?

@acostalima
Copy link
Collaborator

@acostalima, I can't find any, unfortunately. It's a bit of a generic error that does not lead to anything. What was yours?

When I put this demo together, everything was working fine so I don't recall getting this error when using add. If React Native does not give you a stack trace, you'll have to dig deeper into IPFS.

@jcoulaud
Copy link

jcoulaud commented Dec 7, 2021

@acostalima the demo is working fine :) It's on new React Native versions that it's breaking.

@acostalima
Copy link
Collaborator

acostalima commented Dec 7, 2021

@acostalima the demo is working fine :) It's on new React Native versions that it's breaking.

Ah, I see! 😄
Yeah, v0.64 was not released at the time. Unfortunately, I don't have the time to take a good look at this right now, sorry.

I've just took a quick look at ipfs/js-ipfs#3751, and there's a good chance the error reported by @ravi0the0sun may lie in react-native-fetch-api.

@jcoulaud
Copy link

jcoulaud commented Dec 7, 2021

All right, thank you!

@Haianh9999
Copy link

@acostalima I got the same error could you tell me how to solve it?
I'm using react-native version 0.64.1, ipfs-http-client version 56.0.2 🙇

@Haianh9999
Copy link

@jcoulaud Could you help me to solve this problem? 🙇

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

No branches or pull requests

4 participants