Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

174
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda