0

i'm running nodejs application on localhost, everything went smooth until i encountered this error

Error: getLeaguePositions request FAILED; required params `id/summonerId/playerId` (int), `accountId/accId` (int), or `name` (string) not passed in
at updateLeague (C:\Users\Mikk\be\helpers\summonerProfile.js:104:27)

Not sure how would i approach to this error? My code for that method

function updateLeague(profile) {
  const { region } = profile;
  return leagueApi.League.positions({id: profile['summonerId'], region})
  .then((league) => {
    let leagueRanks = [];
    for (let entry of league) {
      let { queueType, tier, rank, leaguePoints } = entry;
      leagueRanks.push({
        queueType,
        tier,
        division: rank,
        leaguePoints
      });
    }
    profile['leagueRanks'] = leagueRanks;
    return profile;
  }).catch((err) => {
    if (err.message == 'Error getting league data: 404 Not Found') {
      return profile;
    }
    else {
      handleErr(err);
    }
  });
}
  • can you add the route definition and how you make the call to the endpoint – riyaz-ali Jun 12 '17 at 14:53
  • Class too long so including pastebin link. https://pastebin.com/VydTZUDQ – Mikk Küttim Jun 12 '17 at 14:58
  • You are not supplying a _required_ `accountId/accId` (int) or `name` (string) parameter at Line 2 of the `updateLeague()` method causing the request to fail – riyaz-ali Jun 12 '17 at 15:05
  • I still can't figure it out what should i put there, could be common sense. – Mikk Küttim Jun 12 '17 at 15:11
  • Perhaps the name of the id property should be summonerId. That's just a guess based on looking at getSummonerLeaguePositions docs [here](https://www.npmjs.com/package/lol-riot-api-module#getSummonerLeaguePositions). If that's not the right API please link the correct one. – James Jun 12 '17 at 15:14
  • That's the correct api: https://github.com/ChauTNguyen/kindred-api @James – Mikk Küttim Jun 12 '17 at 15:15
  • That info really needs to be part of your question. – James Jun 12 '17 at 15:17
  • Yeah could be, i'm just having difficulties importing it. – Mikk Küttim Jun 12 '17 at 15:22
  • So looking at the [source code for the API](https://github.com/ChauTNguyen/kindred-api/blob/master/src/kindred-api.js) (lines 1069-1106), the error is probably caused because profile['summonerId'] is not an integer. – James Jun 12 '17 at 15:25
  • It's not an int, its an number @james – Mikk Küttim Jun 12 '17 at 16:43

0 Answers0