Unable to save inside a json file

javascript

#1

Hello, I have a very annoying problem here, I’ve tried it many times but it does not save the information in serverData.json, I think glitch will not let save, can you help me?
`message.channel.send("Ativando chave... aguarde");

          if(!serverData[message.guild.id]) serverData[message.guild.id] = {
               "key": args.toString()
          }
       
           serverData[message.guild.id].key = args.toString();
            try {
              file.writeFile("./serverData.json", JSON.stringify(serverData), (err) => {
                if(err){
                  console.log(err);
                  return message.channel.send("```Algum erro ocorreu! não fique triste, tente denovo em alguns minutos```");
                }else{
                  message.channel.send("```Chave ativada, você ja pode me usar como quiser ( ͡° ͜ʖ ͡°)```");
                }
              });
              
            } catch (err) {
              return message.channel.send("```Algum erro ocorreu! não fique triste, tente denovo em alguns minutos```");
            }`

#2

Hey @DogsBR, welcome to the Glitch forum!

I think you’re probably running to the fact that file changes on the backend (like file changes from code) aren’t synced to your project’s editor automatically. You have to run the refresh command in your project’s console to be able to see them.

Hope this helps, but if not please let us know!


#3

Thank you very much: D, you saved me, I’m 1 whole day trying to make him save