danielwerg / r6api.js

🍫 Node.js wrapper around Rainbow Six Siege APIs
https://npm.im/r6api.js
MIT License
111 stars 19 forks source link

getRanks error #55

Closed Nattends closed 3 years ago

Nattends commented 3 years ago

Hi, I am using the API as a beginner for a small personal project. Everything works fine, but when it comes to using getRanks, I get an error that I don't understand while using the example.

Here's the error:

(node:6140) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined at c:\Users\natha\node_modules\r6api.js\lib\methods\getRank.js:28:41 at Array.map () at c:\Users\natha\node_modules\r6api.js\lib\methods\getRank.js:24:16 at Array.reduce () at c:\Users\natha\node_modules\r6api.js\lib\methods\getRank.js:22:12 at processTicksAndRejections (internal/process/task_queues.js:95:5) at async get_rank (c:\Users\natha\Documents\Phauque\test.js:5:18) (Use node --trace-warnings ... to show where the warning was created) (node:6140) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:6140) [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.

And the code:

async function get_rank() { const allRank = await r6api.getRanks('uplay', 'eace65b1-68d3-43da-8229-2ab8f742bd2a', { regions: ['emea'] }); console.log(allRank) } get_rank();