js-ipfs icon indicating copy to clipboard operation
js-ipfs copied to clipboard

ipfs-grpc-client is importing from @improbable-eng/grpc-web incorrectly

Open rj-calvin opened this issue 3 years ago • 1 comments

  • Platform:
    • Linux CJRm-ARTIX 5.19.2-artix1-2 #1 SMP PREEMPT_DYNAMIC Sun, 21 Aug 2022 10:48:27 +0000 x86_64 GNU/Linux
    • Brave Browser 104.1.42.88

Severity:

Critical. This causes an exception to be thrown when invoking create with a grpc url.

Description:

The following exception is thrown:

TypeError: undefined is not an object (evaluating 'import_grpc_web2.default.grpc')

This identifies the problem occurring at ipfs-grpc-client/src/index.js:

// ...
// line 3:
import grpcWeb from '@improbable-eng/grpc-web';
// ...
// line 47:
    addAll: grpcAddAll(grpcWeb.grpc, service.Root.add, options),
// ...

The documentation from @improbable-eng/grpc-web would imply that this import on line 3 should instead be:

import { grpc } from '@improbable-eng/grpc-web';

Steps to reproduce the error:

I have create invoked as follows:

const client = create({
  grpc: 'ip4/127.0.0.1/tcp/5002/ws'
});

~~I would be willing to create a PR.~~ (the build environment here is pretty foreign to me. I can't seem to get the package to build. I didn't think this would take too much time to fix, which is why I offered, but it might be best to defer to you guys).

rj-calvin avatar Sep 05 '22 03:09 rj-calvin

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

welcome[bot] avatar Sep 05 '22 03:09 welcome[bot]

2022-10-07 triage conversation: what bundler are you using? Do you have a reproducible repo people can look at? It may also be more expedient to post in discuss.ipfs.tech for other community members to engage.

BigLep avatar Oct 07 '22 14:10 BigLep

Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.

github-actions[bot] avatar Oct 14 '22 00:10 github-actions[bot]

https://codesandbox.io/s/bitter-resonance-enf7fn

If you go to this sandbox and type in anything in the GRPC address, then once you hit "connect" the error will appear in the console.

Note: for some reason the latest version of ipfs-client doesn't work in codesandbox. Though I think that the version that is being used has the same logic.

rj-calvin avatar Oct 20 '22 21:10 rj-calvin

Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.

github-actions[bot] avatar Oct 28 '22 00:10 github-actions[bot]

Arg, I have properly taggedt this to show it needs maintainer input.

BigLep avatar Oct 28 '22 00:10 BigLep

js-ipfs is being deprecated in favor of Helia. You can https://github.com/ipfs/js-ipfs/issues/4336 and read the migration guide.

I believe this should be resolved in Helia, if not, please let us know by reopening this issue before 2023-06-05!

whizzzkid avatar May 31 '23 06:05 whizzzkid