Samy Rharade
Samy Rharade

Reputation: 93

Why this error come: Error: connect ECONNREFUSED?

I'm trying to connect to the API Mailchimp but I have this error that come when I launch the app.js.

import mailchimp from "@mailchimp/mailchimp_marketing";

mailchimp.setConfig({
  apiKey: "apiKey",
  server: "server",
});

async function run() {
  const response = await mailchimp.ping.get();
  console.log(response);
}

run();

And here is the complete error:

(node:27226) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 0.0.0.0:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:27226) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:27226) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Upvotes: 0

Views: 18694

Answers (1)

Exelian
Exelian

Reputation: 5888

ECONNREFUSED means that your OS isn't able to setup a TCP connection. There's no service listening on 0.0.0.0:443, which is your own computer. Are you sure that 0.0.0.0 is the host you need to connect to?

Either you need to start the required service on your computer or you need to use the correct IP address (whatever that may be).

Upvotes: 0

Related Questions