Skip to content

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

Closed

Description

@ghazel

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

Activity

  1. pensierinmusica commented on Oct 13, 2013

    @pensierinmusica

    👍

    Please fix it :)

  2. dresende commented on Oct 14, 2013

    @dresende
    Owner

    Please test this commit.

    npm install dresende/node-orm2
  3. pensierinmusica commented on Oct 14, 2013

    @pensierinmusica

    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

  4. dresende commented on Oct 14, 2013

    @dresende
    Owner

    Done. 2.1.3 in npm now.

  5. nurrony commented on Dec 2, 2013

    @nurrony

    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

  6. lewisoaten commented on Dec 3, 2013

    @lewisoaten

    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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions