gretzky / nhl-api

NHL data and utilities to work with it

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getPlayers endpoint returns an error

taylorbourne opened this issue · comments

This is the request I'm running:

  nhl.getPlayer({
    name: "wayne"
  }).then(players => {
    console.log('huh', players)
    res.status(200).json({ players })
  }).catch(error => {
    console.log('error ', error)
    res.status(500)
  })

Basically just trying to fetch a player using just the name property – but I'm getting a type error. Any help is much appreciated.

 TypeError: Cannot read property 'some' of undefined
    at /Users/taylorbourne/_PROJECTS/_NAMESAUCER/_WEB/namesaucer/node_modules/@nhl-api/client/lib/src/util/index.js:26:23
    at Array.filter (<anonymous>)
    at Object.exports.getId (/Users/taylorbourne/_PROJECTS/_NAMESAUCER/_WEB/namesaucer/node_modules/@nhl-api/client/lib/src/util/index.js:25:27)
    at Object.exports.handleUrl (/Users/taylorbourne/_PROJECTS/_NAMESAUCER/_WEB/namesaucer/node_modules/@nhl-api/client/lib/src/util/index.js:45:23)
    at Object.<anonymous> (/Users/taylorbourne/_PROJECTS/_NAMESAUCER/_WEB/namesaucer/node_modules/@nhl-api/client/lib/src/player/index.js:15:32)
    at Generator.next (<anonymous>)
    at /Users/taylorbourne/_PROJECTS/_NAMESAUCER/_WEB/namesaucer/node_modules/@nhl-api/client/lib/src/player/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/taylorbourne/_PROJECTS/_NAMESAUCER/_WEB/namesaucer/node_modules/@nhl-api/client/lib/src/player/index.js:4:12)
    at Object.getPlayer (/Users/taylorbourne/_PROJECTS/_NAMESAUCER/_WEB/namesaucer/node_modules/@nhl-api/client/lib/src/player/index.js:14:12)