Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

451
Vistas
aws document db not working from node.js application

express.js code

    var mongoose = require("mongoose");
    const { db } = require("../../models/userModel");
    mongoose.connect("mongodb://cnoxbeta:abdf1234@cnox-beta-document-db.cluster-cvzxy5kwx8pn.us-west-2.docdb.amazonaws.com:27017/cnox?ssl=true&ssl_ca_certs=rds-combined-ca-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false");

error:

    (node:1239) UnhandledPromiseRejectionWarning: Error: error:0909006C:PEM routines:get_name:no start line
        at Object.createSecureContext (_tls_common.js:149:17)
        at Object.connect (_tls_wrap.js:1580:48)
        at makeConnection (/home/ubuntu/cnox-webbackend/node_modules/mongoose/node_modules/mongodb/lib/cmap/connect.js:274:31)
        at connect (/home/ubuntu/cnox-webbackend/node_modules/mongoose/node_modules/mongodb/lib/cmap/connect.js:33:5)
        at checkServer (/home/ubuntu/cnox-webbackend/node_modules/mongoose/node_modules/mongodb/lib/sdam/monitor.js:201:27)
        at /home/ubuntu/cnox-webbackend/node_modules/mongoose/node_modules/mongodb/lib/sdam/monitor.js:231:9
        at executeAndReschedule (/home/ubuntu/cnox-webbackend/node_modules/mongoose/node_modules/mongodb/lib/utils.js:791:9)
        at makeInterruptibleAsyncInterval (/home/ubuntu/cnox-webbackend/node_modules/mongoose/node_modules/mongodb/lib/utils.js:798:9)
        at Monitor.connect (/home/ubuntu/cnox-webbackend/node_modules/mongoose/node_modules/mongodb/lib/sdam/monitor.js:87:71)
        at Server.connect (/home/ubuntu/cnox-webbackend/node_modules/mongoose/node_modules/mongodb/lib/sdam/server.js:100:28)
    (Use `node --trace-warnings ...` to show where the warning was created)

I am using aws document db to connect my node application . I am able to access mongo db using shell so mongodb is fine and access ip whitelisting is fine. Something wrong in the connection . Please take a look how can i fix this

Note: I am able to connect using shell

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Check the Mongoose version in the package.json file.

With version v6+ you should not add useNewUrlParser and useUnifiedTopology options, so you should remove these options. Mongoose will set them to true by default.

over 4 years ago · Santiago Trujillo Denunciar

0

Can you try this?

mongoose.connect('mongodb://<user>:<pass>@cnox-beta-document-db.cluster-cvzxy5kwx8pn.us-west-2.docdb.amazonaws.com:27017/cnox?replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false', {
  ssl: true,
  sslValidate: true,
  sslCA: `path_to/rds-combined-ca-bundle.pem`
});

Reference.

PS: You might want to remove the credentials from your initial question.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda