nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.45k stars 278 forks source link

DNS resolution failure on extremely simple Express server. #4206

Closed JB0925 closed 1 year ago

JB0925 commented 1 year ago

Details

I have run into an issue lately where I am starting a very simple Express server and, upon doing so, am getting the DNS resolution error of ENOTFOUND.

The weird thing, though, is that the hostname is “base,” as in it seems to be trying to resolve the hostname of base. The code is very simple “app.listen(8080, () => console.log(“hello”))”

This happens even if I pass in a host to listen.

I know that a workaround would be to change the /etc/hosts file to include “127.0.0.1 base”, but I am curious if this has been brought up before and where “base” could be coming from. I spent a good bit of time debugging through source code but still cannot understand why it is trying to resolve “base.”

Any ideas would be appreciated. Thank you.

Node.js version

19.7.0

Example code

const express = require(“express”);

app = express();

app.listen(8080, () => console.log(“hello”));

Operating system

Mac OS

Scope

Runtime

Module and version

dns

preveen-stack commented 1 year ago

can you share the log

tanakatoo commented 1 year ago

Hi, I'm getting the same "base" error. Did you find out why? Thanks.

JB0925 commented 1 year ago

@preveen-stack , sure. Thank you.

node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

Error: getaddrinfo ENOTFOUND base
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'base'
}

Node.js v19.7.0

I used a debugger to follow a call all the way until it reached that point, but did not see anything that stuck out as to why it would be setting the hostname as base. Thanks for taking a look.

JB0925 commented 1 year ago

@tanakatoo quick question: are you using node-pg client library for connecting and interacting with Postgres?

tanakatoo commented 1 year ago

Yes I am!

On Tue, Jul 25, 2023 at 12:57 AM Jesse Brink @.***> wrote:

@tanakatoo https://github.com/tanakatoo quick question: are you using node-pg client library for connecting and interacting with Postgres?

— Reply to this email directly, view it on GitHub https://github.com/nodejs/help/issues/4206#issuecomment-1648186295, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARYSPPTTCIR75E7HHRLODQTXR2LM5ANCNFSM6AAAAAA2Q4JH7U . You are receiving this because you were mentioned.Message ID: @.***>

tanakatoo commented 1 year ago

Thanks, I'll try different versions to see if it fixes the problem when I have time. For now, I'm using your hack of adding base to the etc/hosts file.

On Tue, Jul 25, 2023 at 9:12 AM Jesse Brink @.***> wrote:

I was talking to someone else and they determined that this is actually an issue with node-pg v8.11.0

Downgrading to anything lower seemed to solve it for them. On the other side, I checked out their Github issues and it seems like it was fixed in 8.11.1. So you can probably try that one, too. I haven’t tried it myself, as I was only looking into this to help someone else.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Karmen Too @.> Sent: Monday, July 24, 2023 8:09:35 PM To: nodejs/help @.> Cc: Jesse Brink @.>; Author @.> Subject: Re: [nodejs/help] DNS resolution failure on extremely simple Express server. (Issue #4206)

Yes I am!

On Tue, Jul 25, 2023 at 12:57 AM Jesse Brink @.***> wrote:

@tanakatoo https://github.com/tanakatoo quick question: are you using node-pg client library for connecting and interacting with Postgres?

— Reply to this email directly, view it on GitHub https://github.com/nodejs/help/issues/4206#issuecomment-1648186295, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ARYSPPTTCIR75E7HHRLODQTXR2LM5ANCNFSM6AAAAAA2Q4JH7U>

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub< https://github.com/nodejs/help/issues/4206#issuecomment-1648783480>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AJSLRITXH6FHQ3VBNELCQLLXR4FD7ANCNFSM6AAAAAA2Q4JH7U>.

You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/nodejs/help/issues/4206#issuecomment-1648785320, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARYSPPTETRFDM354VZG7PFLXR4FPTANCNFSM6AAAAAA2Q4JH7U . You are receiving this because you were mentioned.Message ID: @.***>

JB0925 commented 1 year ago

Closing as I believe we’ve found the issue, as mentioned above.