Skip to content

cause: Error: socket hang up error on Ubuntu 22.4 but it works perfectly fine on windows #443

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

Closed
yechalede opened this issue Oct 1, 2024 · 2 comments

Comments

@yechalede
Copy link

yechalede commented Oct 1, 2024

i am using node 21. and axios 1.6 to make https request it works on window but,
when i deployed it on Ubuntu i am getting this socket hang up error .
please help.

 cause: Error: socket hang up
      at connResetException (node:internal/errors:705:14)
      at Socket.socketOnEnd (node:_http_client:518:23)
      at Socket.emit (node:events:525:35)
      at endReadableNT (node:internal/streams/readable:1358:12)
      at processTicksAndRejections (node:internal/process/task_queues:83:21) {
    code: 'ECONNRESET'
  }
}

Screenshot from 2024-10-01 15-52-17

Screenshot from 2024-10-01 15-56-11

@yechalede
Copy link
Author

here is the code:

case "DASX001":
          axios
            .post(
              `http://10.10.10.12:7088/realms/v2/protocol/openid-connect/token`,
              new URLSearchParams({
                grant_type: "password",
                client_id: "xxxx",
                client_secret: "xxxxxx",
                username: "xxxxx",
                password: "Pxxxxxx2024",
              }),
              {
                headers: {
                  "Content-Type": "application/x-www-form-urlencoded",
                },
              }
            )
            .then(async (resp) => {
              let token = resp.data.access_token;

              await axios
                .get(
                  "https://10.50.50.50:9090/v3/getCurrentBalance/0000004220xx/",
                  {
                    headers: {
                      Authorization: `Bearer ${token}`,
                      "Content-Type": "application/json",
                    },
                  }
                )
                .then((resp) => {
                 
                  if (resp.data.statusCode == "200") {
                    current_balance = new Intl.NumberFormat("en-US").format(
                      resp.data.balance
                    );
                    console.log(resp);
                    return res.json({ current_balance });
                  }
                });
            });
          break;
        case "BOX001":

@gautamsi
Copy link
Owner

gautamsi commented Oct 1, 2024

unrelated to this project

@gautamsi gautamsi closed this as completed Oct 2, 2024
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

2 participants