deno_std icon indicating copy to clipboard operation
deno_std copied to clipboard

Need explanation, net node module return Not implemented error

Open billyadelphia opened this issue 3 years ago • 2 comments

I'm trying to understand the issue about Not implemented error on net module, so I could try to fix an issue with web3 package

Here the code and the error messages

import net from "https://deno.land/[email protected]/node/net.ts";
import Web3 from "https://deno.land/x/web3/mod.ts";

const provider = new Web3.providers.IpcProvider(
      "/root/geth_data/geth.ipc",
      net
    );
const web3 = new Web3(provider);
error: Uncaught (in promise) Error: Not implemented
  throw new Error(message);
        ^
    at notImplemented (https://deno.land/[email protected]/node/_utils.ts:23:9)
    at Pipe.connect (https://deno.land/[email protected]/node/internal_binding/pipe_wrap.ts:93:5)
    at _internalConnect (https://deno.land/[email protected]/node/net.ts:470:36)
    at defaultTriggerAsyncIdScope (https://deno.land/[email protected]/node/_async_hooks.ts:57:18)
    at Socket.connect (https://deno.land/[email protected]/node/net.ts:926:7)
    at Object.connect (https://deno.land/[email protected]/node/net.ts:1580:17)
    at new IpcProvider (https://deno.land/x/[email protected]/packages/web3-providers-ipc/src/index.js:35:25)

Expected behavior No error, web3 will connect normally to the ipc

Environment

  • OS: Ubuntu 20.04
  • deno version: 1.18.2
  • std version: 0.125.0

billyadelphia avatar Feb 18 '22 02:02 billyadelphia

IPC feature is not yet implemented in Deno, and therefore IPC features of std/node are not available yet.

The feature is worked on this PR https://github.com/denoland/deno/pull/13566

kt3k avatar Feb 20 '22 10:02 kt3k

Unix domain socket support as added in #2146

// demo.ts
import net from "https://deno.land/std/node/net.ts";
import Web3 from "https://deno.land/x/web3/mod.ts";

const provider = new Web3.providers.IpcProvider(
  "/root/geth_data/geth.ipc",
  net
);

const web3 = new Web3(provider);

console.log(web3);
$  deno run --unstable --allow-env --allow-read --allow-write ./demo.ts

...

Appears to be working as far as can tell. @billyadelphia would be good to confirm if all good your end?

cmorten avatar May 22 '22 11:05 cmorten

I'm pretty sure this issue should be closed.

lino-levan avatar Oct 15 '22 15:10 lino-levan

I confirmed the below script working now.

import net from "https://deno.land/[email protected]/node/net.ts";
import Web3 from "https://deno.land/x/web3/mod.ts";
const provider = new Web3.providers.IpcProvider("geth.ipc", net);
const web3 = new Web3(provider);

kt3k avatar Oct 16 '22 07:10 kt3k