js-ipfs
js-ipfs copied to clipboard
ipfs-grpc-client is importing from @improbable-eng/grpc-web incorrectly
- Version: [email protected]
- Platform:
Linux CJRm-ARTIX 5.19.2-artix1-2 #1 SMP PREEMPT_DYNAMIC Sun, 21 Aug 2022 10:48:27 +0000 x86_64 GNU/LinuxBrave 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).
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.
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.
Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.
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.
Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.
Arg, I have properly taggedt this to show it needs maintainer input.
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!