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

328
Vistas
How to fix UnhandledPromiseRejectionWarning: TypeError?

So I am making a web app using Express.JS and MongoDB and when I try to run it locally , it works, but when I run it with my aws Ubuntu 20.04 machine it gives me the following error:

(node:13452) UnhandledPromiseRejectionWarning: TypeError: [objectOptions,urlOptions,exports.DEFAULT_OPTIONS].flatMap is not a function
    at parseOptions (/home/ubuntu/tylertv/node_modules/mongodb/lib/connection_string.js:258:77)
    at new MongoClient (/home/ubuntu/tylertv/node_modules/mongodb/lib/mongo_client.js:62:63)
    at Promise (/home/ubuntu/tylertv/node_modules/mongoose/lib/connection.js:784:16)
    at new Promise (<anonymous>)
    at NativeConnection.Connection.openUri (/home/ubuntu/tylertv/node_modules/mongoose/lib/connection.js:781:19)
    at _mongoose._promiseOrCallback.cb (/home/ubuntu/tylertv/node_modules/mongoose/lib/index.js:342:10)
    at Promise (/home/ubuntu/tylertv/node_modules/mongoose/lib/helpers/promiseOrCallback.js:32:5)
    at new Promise (<anonymous>)
    at promiseOrCallback (/home/ubuntu/tylertv/node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:10)
    at Mongoose._promiseOrCallback (/home/ubuntu/tylertv/node_modules/mongoose/lib/index.js:1181:10)
(node:13452) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:13452) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I have no clue why this is doing this all I have installed is mongodb,npm, and node.

https://www.github.com/tttylerr/tylertv

^ My source code is server.js mainly

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This could happen by several reasons:

  1. Do you have MongoDB installed on you AWS machine?
  2. Do versions of Node.js/NPM/MongoDB mismatch on your local machine and on AWS machine?

P.S. If that error occurs on startup, then the error can be interpreted as - "Couldn't connect to MongoDB instance". Check that stuff related to Mongo.

about 4 years ago · Juan Pablo Isaza 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