Js-ipfs http API connection refused

Hi, I’m trying to access my ipfs node (created with js-ipfs in nodejs) over http API (in the aim of using js-ipfs-cluster), but everytime I tried I got a connection refused error.

node : 12.9.1.
Js-ipfs version : 0.50.2.

After reading some post about it I tried to allow CORS request but nothing changed.

const ipfsNode = await IPFS.create({ 
        repo: './jsipfs',
        config: {
            Addresses: {
              Swarm: [
              API: '/ip4/',
              Gateway: '/ip4/'
    const key1 = 'API.HTTPHeaders.Access-Control-Allow-Origin'
    const val1 = ['*']
    ipfsNode.config.set(key1, val1)

    const key2 = 'API.HTTPHeaders.Access-Control-Allow-Methods'
    const val2 = ["PUT", "POST", "GET"]
    ipfsNode.config.set(key2, val2)

I’m using postman to do the http request (which works well if a download ipfs cli for windows).

Any idea about what should I do to make it work ?

Connection Refused error normally means the port you think is open isn’t even listening, or the url has a typo or something like that, and isn’t an indication that some code tried to do something and failed.

The url works well, If I launch ipfs with the CLI and change the port it works. I got a response.

I use this url : (request type : POST)

So if the port is not open or not listening, it means perhaps something is missing in my node project ?

I just created and init a new emtpy node project and added js-ipfs by doing :
yarn add ipfs

Do I need to add others packages ?

This kinda thing might help you check addresses,

const ipfsNode = await IPFS.create();
const addresses = await ipfsNode.swarm.localAddrs();

but I’ve never done what you’re doing so hopefully someone else can help.

Thansk for the advice, It seems I can only see swarm addresses :
(Which seems to be normal because I called swarm.localAddrs() )

  <Multiaddr 04ac119001060fa2 - /ip4/>,
  <Multiaddr 04194f0c9e060fa2 - /ip4/>,
  <Multiaddr 04c0a80114060fa2 - /ip4/>,
  <Multiaddr 047f000001060fa2 - /ip4/>,
  <Multiaddr 047f000001060fa3dd03 - /ip4/>

See their reply here: Node created with IPFS.create() doesn't accept HTTP API requests · Issue #3563 · ipfs/js-ipfs · GitHub

You need to run a separate command to start the daemon.