qlaffont / fortnite-api

Fortnite API, Get Stats, News And Status
https://twitter.com/qlaffont
MIT License
355 stars 86 forks source link

Any trouble from last MAJ ? #164

Closed mojojoke closed 5 years ago

mojojoke commented 5 years ago

Hey ! i'll not boring you but i just wanna know if probleme comes from me or something else.

I got this error :

(node:9580) UnhandledPromiseRejectionWarning: #<Object>
(node:9580) 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: 2)
(node:9580) [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.

With, the "sample" code :

const Fortnite = require("fortnite-api");

let fortniteAPI = new Fortnite(
    [
        "blablabla@myReelMail.fr",
        "myReelPw",
        "MzQ0NmNkNzI2OTRjNGE0NDg1ZDgxYjc3YWRiYjIxNDE6OTIwOWQ0YTVlMjVhNDU3ZmI5YjA3NDg5ZDMxM2I0MWE=",
        "ZWM2ODRiOGM2ODdmNDc5ZmFkZWEzY2IyYWQ4M2Y1YzY6ZTFmMzFjMjExZjI4NDEzMTg2MjYyZDM3YTEzZmM4NGQ="
    ],
    {
        debug: true
    }
);

fortniteAPI.login().then(() => {
  fortniteAPI
      .checkPlayer("Mirardes", "pc")
      .then(stats => {
          console.log(stats);
      })
      .catch(err => {
          console.log(err);
      });
});

COuld you please juste let me know from where the error comes please ? :)

AScriver commented 5 years ago

@mojojoke You're missing a ".catch()" for the surrounding promise:

fortniteAPI.login().then(() => {
  fortniteAPI
      .checkPlayer("Mirardes", "pc")
      .then(stats => {
          console.log(stats);
      })
      .catch(err => {
          console.log(err);
      });
}).catch(err => {
    console.log(err);
});
Manaf941 commented 5 years ago

I think you're using the 2FA and the module is not compatible with. Change account or disable 2FA. I was having the same issue but I used another account with 2FA disable and it work.