bttmly / nba

Node.js client for nba.com API endpoints

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hangs in shell

garyking opened this issue · comments

commented

My code is this, similar to the tutorial, in Node 8.11.2 and v4.3.0 of this package.

const nba = require('nba');

async function main() {
  const curry = nba.findPlayer('Stephen Curry');
  const player = await nba.stats.playerInfo({ PlayerID: curry.playerId });
  console.log(player);
}

main();

When I run it in my shell with node app.js, it prints the expected info, but then it just hangs and never exits the app, unless I Ctrl-C to kill it.

Is there anything I need to do, for it to end? I've never had this happen before. Does it have something to do with the promise? Yet the promise seems to resolve properly, since the console.log executes.

Hey! Thanks for catching this. I used why-is-node-running and it pointed to something inside node-fetch holding some sort of handle. I bumped the dependency version to latest and seems to have fixed the problem, published in nba@4.3.1. Please let me know if this resolves it for you as well!

commented

Yep it's fixed. Thanks!