Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RequestError: connect ECONNREFUSED 127.0.0.1:4040 #318

Open
yashwanth2714 opened this issue Dec 14, 2023 · 8 comments
Open

RequestError: connect ECONNREFUSED 127.0.0.1:4040 #318

yashwanth2714 opened this issue Dec 14, 2023 · 8 comments

Comments

@yashwanth2714
Copy link

Hello Team,

I occasionally encounter the following error. Could you please help me in resolving it?

image

Code:

image

@cbstns
Copy link

cbstns commented Dec 19, 2023

Bump +1

@samsonquantifi
Copy link

We're running into the same issue
version: 5.0.0-beta.2

@yoandry-quantifi
Copy link

Same error here, with the same version: 5.0.0-beta.2

@neonexus
Copy link

neonexus commented Dec 20, 2023

My recommendation to all at this point: check out Ngrok's official NPM package (still not in full version release yet, but has proven solid for me).

@ngrok/ngrok

Here's a working example for Sails.js: https://github.com/neonexus/sails-react-bootstrap-webpack/blob/release/ngrok.js

@sonu-relay
Copy link

Running ngrok in CI and tests have been failing consistently as of yesterday. Also on 5.0.0-beta.2

@richtr
Copy link

richtr commented Jan 18, 2024

Ran in to the same issue and I could output a clearer, actionable error by trying to launch ngrok directly:

$> node_modules/ngrok/bin/ngrok http 8080

That displayed an ERR_NGROK_4018 error code which led to this explanation:

You must have a valid account and authtoken to perform this operation. Starting on December 19th 2023, all connections to ngrok will require a valid authtoken.

Sign up for an account: https://dashboard.ngrok.com/signup Install your authtoken: https://dashboard.ngrok.com/get-started/your-authtoken

After following those steps I could persist my authtoken by running the following command, replacing <AUTH_TOKEN> with my actual authentication token and the issue was resolved on next run:

$> node_modules/ngrok/bin/ngrok config add-authtoken <NGROK_AUTH_TOKEN>

Of course, if the error is not ERR_NGROK_4018 when launching ngrok manually then a different fix will be needed.

@tamardu
Copy link

tamardu commented Jan 24, 2024

Thanks @richtr !!!!
it solved my issue as well!
💪🏻 🔥 🥳

@50bbx
Copy link

50bbx commented Mar 8, 2024

Same issue here. I already have the token in my ngrok.yml file, still getting the error.

I created a small script to replicate the issue:

//index.js
import ngrok from "ngrok";

const hostname = "localhost"
const port = 3000

const main = async () => {
try {
    return await ngrok.connect({ addr: `${hostname}:${port}`, onLogEvent: data => {
      console.log(data)
    }, });
  } catch (error) {
    if (
      typeof error.message === "string" &&
      error.message.includes("`version` property is required")
    ) {
      // await upgradeNgrokConfig(spinner);

      try {
        return await ngrok.connect(port);
      } catch (retryError) {
        console.log(
          `Ngrok failed to create a tunnel for port ${port} after configuration upgrade.\n${retryError}`
        );
        return;
      }
    }
    if (
      typeof error.message === "string" &&
      error.message.includes("connect ECONNREFUSED 127.0.0.1:4041")
    ) {
      console.log(
        `Ngrok failed to create a tunnel for port ${port} because ngrok is already running.\n  You may want to use -t flag to use an existing URL that points to the local dev server.`
      );
      return;
    }
    console.log(`Ngrok failed to create a tunnel for port ${port}.\n${error.message}`);
    return;
  }
}


main()

and this is the error:

node index.js 
t=2024-03-08T17:53:21+0100 lvl=info msg="no configuration paths supplied"
t=2024-03-08T17:53:21+0100 lvl=info msg="using configuration at default config path" path="/Users/REDACTED/Library/Application Support/ngrok/ngrok.yml"
t=2024-03-08T17:53:21+0100 lvl=info msg="open config file" path="/Users/REDACTED/Library/Application Support/ngrok/ngrok.yml" err=nil
t=2024-03-08T17:53:21+0100 lvl=info msg="starting web service" obj=web addr=127.0.0.1:4040
t=2024-03-08T17:53:21+0100 lvl=info msg=start pg=/api/tunnels id=7b8c6a52700738e0
t=2024-03-08T17:53:21+0100 lvl=warn msg="ngrok is not yet ready to start tunnels" pg=/api/tunnels id=7b8c6a52700738e0 err="a successful ngrok tunnel session has not yet been established"
t=2024-03-08T17:53:21+0100 lvl=info msg=end pg=/api/tunnels id=7b8c6a52700738e0 status=503 dur=226.209µs
t=2024-03-08T17:53:21+0100 lvl=eror msg="failed to auth" obj=tunnels.session err="Your ngrok-agent version \"3.0.5\" is too old. The minimum supported agent version for your account is \"3.2.0\". Please update to a newer version with `ngrok update`, by downloading from https://ngrok.com/download, or by updating your SDK version. Paid accounts are currently excluded from minimum agent version requirements. To begin handling traffic immediately without updating your agent, upgrade to a paid plan: https://dashboard.ngrok.com/billing/subscription.\r\n\r\nERR_NGROK_121\r\n"
t=2024-03-08T17:53:21+0100 lvl=eror msg="failed to reconnect session" obj=csess id=49e012e56c5a err="Your ngrok-agent version \"3.0.5\" is too old. The minimum supported agent version for your account is \"3.2.0\". Please update to a newer version with `ngrok update`, by downloading from https://ngrok.com/download, or by updating your SDK version. Paid accounts are currently excluded from minimum agent version requirements. To begin handling traffic immediately without updating your agent, upgrade to a paid plan: https://dashboard.ngrok.com/billing/subscription.\r\n\r\nERR_NGROK_121\r\n"
t=2024-03-08T17:53:21+0100 lvl=eror msg="session closing" obj=tunnels.session err="Your ngrok-agent version \"3.0.5\" is too old. The minimum supported agent version for your account is \"3.2.0\". Please update to a newer version with `ngrok update`, by downloading from https://ngrok.com/download, or by updating your SDK version. Paid accounts are currently excluded from minimum agent version requirements. To begin handling traffic immediately without updating your agent, upgrade to a paid plan: https://dashboard.ngrok.com/billing/subscription.\r\n\r\nERR_NGROK_121\r\n"
t=2024-03-08T17:53:21+0100 lvl=info msg="received stop request" obj=app stopReq="{err:0x140002945a0 restart:false}"
t=2024-03-08T17:53:21+0100 lvl=eror msg="terminating with error" obj=app err="Your ngrok-agent version \"3.0.5\" is too old. The minimum supported agent version for your account is \"3.2.0\". Please update to a newer version with `ngrok update`, by downloading from https://ngrok.com/download, or by updating your SDK version. Paid accounts are currently excluded from minimum agent version requirements. To begin handling traffic immediately without updating your agent, upgrade to a paid plan: https://dashboard.ngrok.com/billing/subscription.\r\n\r\nERR_NGROK_121\r\n"
t=2024-03-08T17:53:21+0100 lvl=crit msg="command failed" err="Your ngrok-agent version \"3.0.5\" is too old. The minimum supported agent version for your account is \"3.2.0\". Please update to a newer version with `ngrok update`, by downloading from https://ngrok.com/download, or by updating your SDK version. Paid accounts are currently excluded from minimum agent version requirements. To begin handling traffic immediately without updating your agent, upgrade to a paid plan: https://dashboard.ngrok.com/billing/subscription.\r\n\r\nERR_NGROK_121\r\n"
t=2024-03-08T17:53:21+0100 lvl=warn msg="failed to check for update" obj=updater err="Post \"https://update.equinox.io/check\": context canceled"
Ngrok failed to create a tunnel for port 3000.

But in my CLI I have the latest version, but if I assume correctly, this package doesn't use my global version but the local version installed in this package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants