ipfs icon indicating copy to clipboard operation
ipfs copied to clipboard

error trying to connect: tcp connect error: Connection refused

Open osilkin98 opened this issue 3 years ago • 1 comments

Hi,

I'm using this library with alpeh.js and am trying to create an IPFS node in my browser with const ipfs = new IPFS({}) which seems to work OK. The problem that I'm running into is that attempting to actually make requests to the API fails, and I'm guessing that this is because I have not properly instantiated an IPFS node in my page. I can't find any docs as to how to do this, but would love to help figure it out & contribute.

My current setup is based on version [email protected] of aleph.js at the time of writing.

I'm simply editing pages/index.tsx to contain the following content:

import { Head, Link } from "aleph/react";
import { IPFS } from "https://deno.land/x/[email protected]/mod.ts";

export default async function Index() {
  const ipfs = new IPFS({});
  const myID = await ipfs.id();
  return (
    <div className="screen index">
      <Head>
        <title>Aleph.js</title>
        <meta name="description" content="The Fullstack Framework in Deno." />
      </Head>
      <div>
        <p>{typeof myID === "string" ? myID : "no ID yet"}</p>
      </div>
    </div>
  );
}

But when I actually go to run deno task dev, I'm given the following error:

error: Uncaught (in promise) TypeError: error sending request for url (http://localhost:5001/api/v0/id?): error trying to connect: tcp connect error: Connection refused (os error 61)
  const res = await r
              ^
    at async mainFetch (deno:ext/fetch/26_fetch.js:287:14)
    at async fetch (deno:ext/fetch/26_fetch.js:497:9)
    at async ok (https://deno.land/x/[email protected]/lib/fetch.ts:6:15)
    at async IPFS.id (https://deno.land/x/[email protected]/mod.ts:85:17)
    at async Index (./routes/index.tsx:6:16)

osilkin98 avatar Jun 04 '22 17:06 osilkin98