1

Have a hornet node set up on AWS, able to access the dashboard and interact with the REST API just fine. However when trying to build a connection to it using nodejs @iota/client ClientBuilder cannot connect to it.

async function run() {
    // this doesn't work
    const client = new ClientBuilder().node('https://<my-node-ip>:443').build();
    // this works
    const client = new ClientBuilder().node('https://api.lb-0.h.chrysalis-devnet.iota.cafe').build();
client.getInfo().then(console.log).catch(console.error)

const index = &quot;testIndex&quot;;
const data = `This message was sent at: ${new Date()}`

try{
    const message = await client.message()
     .index(index)
     .data(data)
     .submit();
    console.log(message);
    console.log(message.messageId);
    console.log(data);
    return message.messageId.toString();
}

catch (err){
    console.log(err);
    throw Error(&quot;Not able to send message to tangle&quot;)
}

}

run() .then(() => console.log("Done")) .catch((err) => console.error(err));

Throws an error:

[Error: ClientTask error: Client(NodeError("Couldn't get a result from any node"))]
[Error: ClientTask error: Client(NodeError("Couldn't get a result from any node"))]
Error: Not able to send message to tangle

0 Answers0