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

175
Vistas
TypeError: Cannot read properties of undefined (reading '0') in NodeJS

I have the TypeError: Cannot read properties of undefined (reading '0') with game_id: result.data[0].game_id, warning in my terminal,

What is weird is that the console.log("result ", result); shows me what I need, but below I can't access result.data[0].game_id

Code

return promise1.then((result) => {
      console.log("result ", result); <-- ALL GOOD HERE
      if (!result && !result.data && !result.data[0]) return;
      Stream.findOne({}).then((stream) => {
        if (!stream) {
          let streamInfos = new Stream({
            game_id: result.data[0].game_id, <-- ISSUE HERE

Output of the console.log("result ", result);

{"data":
[{
 "id":"45300981596",
 "user_id":"90849777",
 "user_login":"versifixion",
 "user_name":"VersifiXion",
 "game_id":"21779",
 "game_name":"League of Legends",
 "type":"live",
 "title":"VERSI | Stream test calculez pas | !reseaux",
 "viewer_count":1,
 "started_at":"2022-04-26T21:15:38Z",
 "language":"fr",
 "thumbnail_url":"https://static-cdn.jtvnw.net/previews-ttv/live_user_versifixion-{width}x{height}.jpg",
 "tag_ids":["6f655045-9989-4ef7-8f85-1edcec42d648"],
 "is_mature":false
}],
 "pagination":{}}
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