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

179
Vistas
(nodo: 1788) UnhandledPromiseRejectionWarning: TypeError: No se puede leer la propiedad '4' de undefined

Tengo la siguiente advertencia (verifique la línea comentada en el código) y no sé cómo agregar el objeto promise() ya que mi función no es asíncrona.

 function MostProfitable() { var max = 0; var id; for (var i = 0; i < minmaxcoins.length; i++) { if (Number(minmaxcoins[i][4]) > Number(max)) { max = minmaxcoins[i][4]; id = i; } } try { if (minmaxcoins[id][4] >= 0.6) { // error at this line console.info('Max coin: ', minmaxcoins[id][0], ' ', minmaxcoins[id][1]); console.info('Min coin: ', minmaxcoins[id][2], ' ', minmaxcoins[id][3]); console.info('Profit: ', minmaxcoins[id][4], '%'); const d = new Date(); opportunity = opportunity + 1; console.info( opportunity, ' ***********************************************', d ); begin(); } } catch (error) { console.error(error); begin(); } }

aquí está el error/advertencia:

 (node:1788) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '4' of undefined at MostProfitable (/home/root1/hft.js:274:20) at getMax (/home/root1/hft.js:261:2) at pairprice (/home/root1/hft.js:175:2) at getcoins (/home/root1/hft.js:116:1) at binance.bookTickers (/home/root1/hft.js:69:2) at Request.request [as _callback] (/home/root1/node_modules/node-binance-api/node-binance-api.js:3296:24) at Request.self.callback (/home/root1/node_modules/request/request.js:185:22) at Request.emit (events.js:198:13) at Request.<anonymous> (/home/root1/node_modules/request/request.js:1154:10) at Request.emit (events.js:198:13) (node:1788) 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: 1) (node:1788) [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.

Sé que es solo una advertencia, pero noté que la aplicación falla, ya que debería funcionar las 24 horas del día, los 7 días de la semana, sin parar. ¿Alguien puede explicar este problema?

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