Error with glitch, Some codes not working on glitch

Hello guys, i have error with glitch some codes when i put it in glitch it shows error but when i put it in VSC to run my bot is ok no errors i copy all my commands to glitch it works some of them, i also copyed package.json of discord bot to glitch.

This is some image of error in glitch:


i got no errors in Visual Studio Code.

Could you share your project/code?

Rock, Paper, Scissors game. the problem is in this line if(player1.first().content == "exit")

if(!message.guild) return;
      let choice = ['Rock','Paper','Scissors'];
      let user = message.mentions.users.first();
      if(!user) return message.reply(`Please try again and mention user to play.`).then(m=>m.delete(10000)).catch(()=>{return});
      if(user.bot) return message.channel.send(`You cant play with bots.`).then(m=>m.delete(7000)).catch(()=>{return});
      if(message.author.id === user.id) return message.channel.send(`You cant play ur self.`);
      const player1 = m => m.author.id === message.author.id;
      const player2 = m1 => m1.author.id === user.id;
      let msg1;
      message.channel.send(`**${message.author.username}**, Choose: \`(1)Rock (2)Paper (3)Scissors\`.`).then(m=>{
          msg1 = m.id;
      }).catch(()=>{return})
      message.channel.awaitMessages(player1, {max: 1, time:30000})
      .then(player1=>{
          if(player1.first().content === 'exit'){
          return message.channel.send(`Game Canceled!`);
          }

          let player1Choice = player1.first().content;
          function cases(caseChoice){
              player1Choice.toLowerCase().includes("1")?caseChoice = '1':''
              player1Choice.toLowerCase().includes("2")?caseChoice = '2':''
              player1Choice.toLowerCase().includes("3")?caseChoice = '3':''
              player1Choice.toLowerCase().includes("rock")?caseChoice = 'rock':''
              player1Choice.toLowerCase().includes("paper")?caseChoice = 'paper':''
              player1Choice.toLowerCase().includes("scissor")?caseChoice = 'scissor':''
              message.channel.fetchMessage(msg1).then(m=>m.delete()).catch(()=>{return})
              return caseChoice;
          }
              switch (cases()) {
          case "1":
              player1.first().delete().catch(()=>{return});
              player1Choice = choice[0];
              break;
          case "2":
              player1.first().delete().catch(()=>{return});
              player1Choice = choice[1];
              break;
          case "3":
              player1.first().delete().catch(()=>{return});
              player1Choice = choice[2];
              break;
          case "rock":
              player1.first().delete().catch(()=>{return});
              player1Choice = choice[0];
              break;
          case "paper":
              player1.first().delete().catch(()=>{return});
              player1Choice = choice[1];
              break;
          case "scissors":
              player1.first().delete().catch(()=>{return});
              player1Choice = choice[2];
              break;
          default:
              message.channel.send(`Wrong Choice \`${message.author.username}\`, Try again.`).then(m=>m.delete(7000)).catch(()=>{return});
              message.delete().catch(()=>{return});
              return;
          }
          let msg2;
          message.channel.send(`**${user.username}**, Choose: \`(1)Rock (2)Paper (3)Scissors\`.`).then(m=>{
              msg2 = m.id;
          }).catch(()=>{return})
          message.channel.awaitMessages(player2, {max: 1, time:30000})
          .then(player2=>{
              if(player2.first().content == 'exit' || player1.first().content == 'exit'){
              return message.channel.send(`Games Canceled!`).catch(()=>{return});;
              }
              let player2Choice = player2.first().content.toLowerCase();
              function cases(caseChoice){
                  player1Choice.toLowerCase().includes("1")?caseChoice = '1':''
                  player1Choice.toLowerCase().includes("2")?caseChoice = '2':''
                  player1Choice.toLowerCase().includes("3")?caseChoice = '3':''
                  player1Choice.toLowerCase().includes("rock")?caseChoice = 'rock':''
                  player1Choice.toLowerCase().includes("paper")?caseChoice = 'paper':''
                  player1Choice.toLowerCase().includes("scissor")?caseChoice = 'scissor':''
                  message.channel.fetchMessage(msg2).then(m=>m.delete()).catch(()=>{return})
                  return caseChoice;
              }
              switch (cases()) {
                  case "1":
                      player2.first().delete().catch(()=>{return});
                      player2Choice = choice[0];
                      break;
                  case "2":
                      player2.first().delete().catch(()=>{return});
                      player2Choice = choice[1];
                      break;
                  case "3":
                      player2.first().delete().catch(()=>{return});
                      player2Choice = choice[2];
                      break;
                  case "rock":
                      player2.first().delete().catch(()=>{return});
                      player2Choice = choice[0];
                      break;
                  case "paper":
                      player2.first().delete().catch(()=>{return});
                      player2Choice = choice[1];
                      break;
                  case "scissor":
                      player2.first().delete().catch(()=>{return});
                      player2Choice = choice[2];
                  break; 
              default:
                  message.channel.send(`Wrong Choice \`${user.username}\`, Try again.`).then(m=>m.delete(7000)).catch(()=>{return});
                  message.delete().catch(()=>{return});
              return;
                  }
                  function result(a1) {
                      if(player1Choice == choice[0] && player2Choice == choice[2] || player1Choice == choice[2] && player2Choice == choice[1] || player1Choice == choice[1] && player2Choice == choice[0]){
                          a1 = `\✅ \`${message.author.username}\` Win`;
                      }
                      if(player1Choice == choice[2] && player2Choice == choice[0] || player1Choice == choice[1] && player2Choice == choice[2] || player1Choice == choice[0] && player2Choice == choice[1]){
                          a1 = `\✅ \`${user.username}\` Win`;
                      }
                      if(player1Choice == player2Choice){
                          a1 = `Tie`;
                      } 
                      return a1;
                  }
                  let embed = new Discord.RichEmbed()
                  .setTitle(`(1)Rock (2)Paper (3)Scissors`)
                  .addField(`${message.author.username}'s Choice`,player1Choice,true)
                  .addField(`${user.username}'s Choice`,player2Choice,true)
                  .addField(`Result`,result())
                  .setFooter(`TIP: type "exit" to cancel the game.`)
                  .setTimestamp()
                  .setColor('#FBFF00')
                  message.channel.sendEmbed(embed);
          }).catch(err=>{
              return message.channel.send(`Time has expired.`).then(m=>m.delete(10000));
          })
      }).catch(err=>{
          return console.error(err);
      })

Do you found the issue?

The error states that player1.first() returns undefined. Try console logging it.

but it works on Visual Studio Code i just copy the same code to glitch.com and it says undefined.

Just try console logging it, that may help you find the error.

Also, don’t use the same name for different variables.
If you have a filter call it “filter” if you have more than one, call it “filter1” or “playerOneFilter” or something
so you dont make mistakes.