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 (postgres hostname with port) #355

Closed
ghazel opened this issue Oct 12, 2013 · 6 comments
Closed

Error: getaddrinfo ENOTFOUND (postgres hostname with port) #355

ghazel opened this issue Oct 12, 2013 · 6 comments

Comments

@ghazel
Copy link

ghazel commented Oct 12, 2013

Between orm 2.1.0 and 2.1.1, a bug crept in when orm.connect is called with a postgres URL which specifies the port as part of the hostname:

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

The error seems to have been introduced in this commit: f566893

@pensierinmusica
Copy link

👍

Please fix it :)

@dresende
Copy link
Owner

Please test this commit.

npm install dresende/node-orm2

@pensierinmusica
Copy link

Hi Diogo, thanks for the fix, it seems to work fine now!

The npm package still needs to be updated though :)

Please let me know when it's all done, so I can use the latest version. Thanks

@dresende
Copy link
Owner

Done. 2.1.3 in npm now.

@nurrony
Copy link

nurrony commented Dec 2, 2013

found same problem still using 2.1.3 here is my code

   var dbport = _dbConfig.port !== '' ? (':'+_dbConfig.port) : ''
    ,_dbDSN =  'mysql://'+_dbConfig.username+':'+_dbConfig.password+'@'+_dbConfig.host + dbport +'/'+_dbConfig.dbname;  

    app.use(orm.express(_dbDSN, {    
        define: function (db, models,next) {
            db.use(paging);
           _.each(dbSchema,function(structure, tblname){
             models[tblname] = db.define(tblname,structure);
           });
           //
           if(_dbConfig.sync){
             db.sync( function (err) {
                !err && console.log("Database Tables Created Successfully!");
             });
           }   
           next();  
        }         
    })); 

Throwing Same error like above, But it is resolved when i pass my db credentials as object not as string.
Am i Doing wrong before.. or still a bug? confused

@lewisoaten
Copy link

This could be by design. I solved it by URL encoding my connection string.

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

No branches or pull requests

5 participants