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

bug: remote peer fault #1961

Closed
tse-lao opened this issue Apr 18, 2024 · 1 comment
Closed

bug: remote peer fault #1961

tse-lao opened this issue Apr 18, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@tse-lao
Copy link

tse-lao commented Apr 18, 2024

This is a bug report

Problem

Having problem getting a correct connection with default defaultBootstrap, it throws me an ['remote pair fault']

Packages
packages:

    "@waku/react": "^0.0.5-8c435e4",
    "@waku/sdk": "^0.0.24",
    "protobufjs": "^7.2.6",

Proposed Solutions

Describe one or several (or none) solutions to fix the problem describe above.

While connected to the defaultBootstrap like

export default  function Feed({ topic, id }: { topic: string, id:string}) {
  return (
    <LightNodeProvider options={{defaultBootstrap: true}}
    protocols={[Protocols.LightPush, Protocols.Store]}
    >
    <div className="m-5 flex flex-col gap-5">
      <PageHeader
        title="Feed"
        subtitle="See what other think about this topic"
      />
      <WakuFeed topic={topic} id={id} />
    </div>
    </LightNodeProvider>
  );
}
  • already tried to add different protocols to see if that makes a different. but it did not.
import { useWaku } from "@waku/react";
import CreateFeed from "./create-feed";
import RetrieveMessages from "./retrieve-messages";

export default function WakuFeed({ topic, id }: { topic: string; id: string }) {
  // Create and start a Light Node
  const { node, error, isLoading } = useWaku();

  if(isLoading) return <div>Loading...</div>
    if(error) return <div>Error: {JSON.stringify(error)}</div>
  return (
    <>
      <div className="py-5">
        {node && <CreateFeed contentTopic={topic} node={node} />}
        {node && <RetrieveMessages contentTopic={topic} node={node} />}
      </div>
      {/* <Post key={index} details={message} /> */}
    </>
  );
}
  • Both retrieve as sending messages do not work.

This is the way I send the message:

  const encoder = createEncoder({ contentTopic });
  const { push } = useLightPush({ node, encoder });
  const [message, setMessage] = useState("");

  
  const sendMessage = async () => {
    if (!push || message.length === 0) {
      return;
    }
      const protoMessage = PProjectFeed.create({
      id: crypto.randomUUID(),
      message: message,
      comments: [],
      likes: 0,
    }); 
    const payload = PProjectFeed.encode(protoMessage).finish();



    const result = await push({ payload: payload });

    console.log(result);
    // Check for errors{
    if (result?.failures && result.failures.length > 0) {
      toast({
        title: `Write to ${contentTopic} failed`,
        description: result.failures[0].error,
      });
      return;
    }
    toast({
      title: "Success",
      description: "Message sent",
    });
  };

If this is a bug report and you know how to fix the problem, feel free to include a proposal or open a PR.
Or feel free to omit this section.
@vpavlin said the following in discord:
This error comes from the service node (nwaku) when there is a problem with Lightpush connection
THe js-waku involvement there should be probably to attempt a reconnection with the node or picking up a different node in case of this error (which it does not do at the moment)

Notes

@weboko weboko self-assigned this Apr 18, 2024
@weboko weboko added the bug Something isn't working label Apr 18, 2024
@weboko weboko changed the title Remote peer fault bug: remote peer fault Apr 18, 2024
@weboko
Copy link
Collaborator

weboko commented Apr 18, 2024

This problem should be fixed within next version of the library.
How new version should be used - waku-org/lab.waku.org#60
Please, install npm i -S @waku/sdk@next or any other library and tell if it helps with the issue observed.

Important: be aware that there are braking changes, follow in particular this one in waku-org/lab.waku.org#60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

3 participants