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

bug: remote peer fault

Open tse-lao opened this issue 10 months ago • 1 comments

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

tse-lao avatar Apr 18 '24 06:04 tse-lao

This problem should be fixed within next version of the library. How new version should be used - https://github.com/waku-org/lab.waku.org/pull/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 https://github.com/waku-org/lab.waku.org/pull/60

weboko avatar Apr 18 '24 22:04 weboko