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

Error: getaddrinfo ENOTFOUND #47

Closed
tjwebb opened this issue Aug 23, 2013 · 11 comments
Closed

Error: getaddrinfo ENOTFOUND #47

tjwebb opened this issue Aug 23, 2013 · 11 comments
Labels

Comments

@tjwebb
Copy link

tjwebb commented Aug 23, 2013

I get this error when trying to do anything:

Error: getaddrinfo ENOTFOUND
    at errnoException (dns.js:37:11)
    at Object.onanswer [as oncomplete] (dns.js:124:16)

I have confirmed that I am passing the correct connection values, and I am not behind a proxy. OSX 10.8, using "pg"

@tgriesser
Copy link
Member

Is there any other information you can provide here - This doesn't look to be an issue with knex, as there's no reference to the library or anything database related here... some googling turned up this on stack overflow - have you taken a look there?

@tjwebb
Copy link
Author

tjwebb commented Aug 24, 2013

I've looked at every SO issue on this, and I'm not able to apply any of them to this situation. The inspect output confirms that my connection parameters are correct.

This is my entire program. Not too complicated.

            var store = new Knex.Initialize({
                debug: true,    // XXX
                client: 'pg',
                connection: {
                    host: process.env.SUBROUTINE_PG_HOST.toString(),
                    user: process.env.SUBROUTINE_PG_USER,
                    password: process.env.SUBROUTINE_PG_PASS,
                    database: process.env.SUBROUTINE_PG_DB,
                    charset: 'utf8'
                }
            });
            console.log(util.inspect(store));
            store.Schema.hasTable('subroutine').then(
                function(exists) {
                    ...
                },
                function(err) {
                    util.log(color.red('[db] Could not check subroutine table: '+ err.stack));
                }
            );

It fails with Could not check subroutine table, and err.stack prints out the error I copied in the OP.

@tjwebb
Copy link
Author

tjwebb commented Aug 24, 2013

Found out something interesting. So I'm just trying to connect to Heroku postgres, I'm just using their dev server as a test.

This does not work, and throws the error above:
export SUBROUTINE_PG_HOST="ec2-54-221-229-7.compute-1.amazonaws.com"

This does work:
export SUBROUTINE_PG_HOST="54.221.229.7"

Using the hostname fails. I obviously don't have DNS issues since I'm typing to this to you right now on github.com, and I can connect fine to that hostname via pgAdmin. Why would this only happen in knex?

@tgriesser
Copy link
Member

That's really odd... Knex's initialize basically just passes through to pg's pg.Client... are you able to connect with the same settings to the database layer there without issue?

@tjwebb
Copy link
Author

tjwebb commented Aug 25, 2013

I haven't tried going directly through pg.Client. Everything is working
with the IP address so I'm going to finish this up and then I'll come up
with a test case.

-tjw

On Sat, Aug 24, 2013 at 5:22 PM, Tim Griesser notifications@github.comwrote:

That's really odd... Knex's initialize basically just passes through to pghttps://github.com/brianc/node-postgres's
pg.Client... are you able to connect with the same settings to the
database layer there without issue?


Reply to this email directly or view it on GitHubhttps://github.com//issues/47#issuecomment-23216878
.

@tybenz
Copy link

tybenz commented Apr 10, 2014

Is there any more on this? I haven't been able to figure this out.

I'm trying to do something very similar to the script above (but with BookshelfJS). I think I have all of the right values from my heroku postgresql DATABASE_URL, but it's not working. I've tried both the ec2 hostname and the IP address approach mentioned. Any ideas?

@bendrucker
Copy link
Member

Can you open a new issue and post your full config?

@tgriesser
Copy link
Member

Why a new issue?

@bendrucker
Copy link
Member

This might be related or they might not — my preference is usually for a new issue if it's not clear that it's an identical problem. That way the new issue is open and it's clear that it needs discussion.

@timhuff
Copy link
Contributor

timhuff commented Mar 22, 2017

Might be a good policy to leave a comment on old issues, linking to the new one. I'm currently wrestling with this problem and would love to read the issue that (I assume) @tgriesser created.

@timhuff
Copy link
Contributor

timhuff commented Mar 22, 2017

For future readers: My issue was running too many concurrent selects.

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

No branches or pull requests

5 participants