Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-236

Opening connection over SSL

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.4.8
    • Component/s: None
    • Labels:
    • Environment:
      Linux
      nodejs v0.10.28

      Hi,
      I am trying to connect to a database hosted in objectrocket.com using node-mongodb-native driver. I can connect without using SSL, everything works fine. Using

      {ssl: true}

      option closes the connection. I don't get too much information from the stacktrace:

      __chain__=false, __wrapped__=[__chain__=false, name=Error, message=connection closed, stack=Error: connection closed
          at null.<anonymous> (../myproject/node_modules/mongodb/lib/mongodb/connection/server.js:597:24)
          at EventEmitter.emit (events.js:92:17)
          at null.<anonymous> (../myproject/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:165:15)
          at EventEmitter.emit (events.js:98:17)
          at Socket.<anonymous> (../myproject/node_modules/mongodb/lib/mongodb/connection/connection.js:548:12)
          at Socket.EventEmitter.emit (events.js:117:20)
          at TCP.close (net.js:465:12)]
      

      Here is my code

      Db = require('mongodb').Db
      Server = require('mongodb').Server
      
      server = new Server config.server, config.ssl_port, ssl: yes
      _db = new Db(config.db_name, server, safe: yes)
      _db.open (err, db) ->
        if err
          console.error "Setup - Error connecting to database", err
          throw err
        db.authenticate config.user, config.password, (err, res) ->
          if err
            console.error "Setup - Error connecting to database", err
            throw err
          console.log "Setup - database configured."
          db.close()
      

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            joeltello Joel Tello
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: