Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"UnhandledPromiseRejectionWarning" in git bash #79

Open
fralonra opened this issue Oct 17, 2018 · 13 comments
Open

"UnhandledPromiseRejectionWarning" in git bash #79

fralonra opened this issue Oct 17, 2018 · 13 comments

Comments

@fralonra
Copy link

When I ran nba-go g in a git bash tool on WIN10, the following error occurred:

(node:21280) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'width' of undefined
    at Object.render (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\cfonts\index.js:464:121)
    at Object.say (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\cfonts\index.js:536:23)
    at cfontsDate (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\lib\cli.js:2:41326)
    at C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\ramda\src\internal\_pipe.js:3:14
    at C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\ramda\src\internal\_arity.js:10:19
    at C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\lib\cli.js:2:21374
    at tryCatch (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\regenerator-runtime\runtime.js:62:40)
    at Generator.invoke [as _invoke] (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\regenerator-runtime\runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as next] (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\regenerator-runtime\runtime.js:114:21)
    at step (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\babel-runtime\helpers\asyncToGenerator.js:17:30)
    at C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\babel-runtime\helpers\asyncToGenerator.js:35:14
    at new Promise (<anonymous>)
    at new F (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\core-js\library\modules\_export.js:36:28)
    at Object.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\babel-runtime\helpers\asyncToGenerator.js:14:12)
    at Object.I [as game] (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\lib\cli.js:2:24827)
    at Command.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\lib\cli.js:2:6890)
    at Command.listener (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\commander\index.js:315:8)
    at emitTwo (events.js:126:13)
    at Command.emit (events.js:214:7)
    at Command.parseArgs (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\commander\index.js:654:12)
    at Command.parse (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\commander\index.js:474:21)
    at Object.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\lib\cli.js:2:7875)
(node:21280) 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: 1)
(node:21280) [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.

It seems that the window-size package is undefined.
The error didn't come up when using other CLI tool, like PowerShell and VSCode.

I'm using:

Win10 64
node v8.11.1
npm v5.6.0
nba-go v0.4.0
@ericpardee
Copy link

Same here:

epardee@nhan7: ~$ nba-go game

⠇ Loading Game Schedule(node:39754) UnhandledPromiseRejectionWarning: FetchError: request to https://stats.nba.com/stats/teaminfocommon?LeagueID=00&Season=2017-18&SeasonType=Regular%20Season&TeamID=1610612761 failed, reason: read ETIMEDOUT
    at ClientRequest.<anonymous> (/usr/local/lib/node_modules/nba-go/node_modules/node-fetch/lib/index.js:1345:11)
    at ClientRequest.emit (events.js:182:13)
    at TLSSocket.socketErrorListener (_http_client.js:391:9)
    at TLSSocket.emit (events.js:182:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:39754) 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: 1)
(node:39754) [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.
⠧ Loading Game Schedule^C

macOS 10.14
node v10.12.0
npm 6.4.1
NBA GO version: 0.4.0

@njomb
Copy link

njomb commented Oct 25, 2018

Same deal here:

njombwe@NJOMBWE-M-G1AS:~/Downloads/nba-go-master$ ./run.sh

██████╗ ██████╗ ██╗ █████╗ ██╗ ██╗ ██████╗ ██╗ ██████╗ ███████╗
╚════██╗ ██╔═████╗ ███║ ██╔══██╗ ██╔╝ ███║ ██╔═████╗ ██╔╝ ╚════██╗ ██╔════╝
█████╔╝ ██║██╔██║ ╚██║ ╚█████╔╝ ██╔╝ ╚██║ ██║██╔██║ ██╔╝ █████╔╝ ███████╗
██╔═══╝ ████╔╝██║ ██║ ██╔══██╗ ██╔╝ ██║ ████╔╝██║ ██╔╝ ██╔═══╝ ╚════██║
███████╗ ╚██████╔╝ ██║ ╚█████╔╝ ██╔╝ ██║ ╚██████╔╝ ██╔╝ ███████╗ ███████║
╚══════╝ ╚═════╝ ╚═╝ ╚════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚══════╝ ╚══════╝

⠹ Loading Game Schedule(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): FetchError: request to https://stats.nba.com/stats/teaminfocommon?LeagueID=00&Season=2017-18&SeasonType=Regular%20Season&TeamID=1610612762 failed, reason: socket hang up
(node:1) 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.
⠇ Loading Game Schedule

macOS 10.14
node v8.9.1
npm 5.5.1
NBA Go Version 0.4.0

@qharlie
Copy link

qharlie commented Oct 25, 2018

stats.nba.com not coming back from the command line, if you paste that into a browser you'll notice it does return data. Might have to mess with the headers to trick nba.com into thinking its a desktop request

@NotNate
Copy link

NotNate commented Oct 27, 2018

This issue happens with me too. This is my error:
Loading Game Schedule(node:1284) UnhandledPromiseRejectionWarning: FetchError: request to https://stats.nba.com/stats/teaminfocommon?LeagueID=00&Season=2017-18&SeasonType=Regular%20Season&TeamID=1610612748 failed, reason: read ECONNRESET at ClientRequest.<anonymous> (C:\Users\NotNate\AppData\Roaming\npm\node_modules\nba-go\node_modules\node-fetch\lib\index.js:1345:11) at emitOne (events.js:116:13) at ClientRequest.emit (events.js:211:7) at TLSSocket.socketErrorListener (_http_client.js:387:9) at emitOne (events.js:116:13) at TLSSocket.emit (events.js:211:7) at emitErrorNT (internal/streams/destroy.js:64:8) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9) (node:1284) 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: 1) (node:1284) [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.

@qharlie
Copy link

qharlie commented Jan 12, 2019

Adding these headers worked for me too :

'Connection': 'keep-alive', 'Accept-Language': 'en-US'

in the getHeaders() function of NbaStatsClient.js in the nba-stats-client package, probably need to let them know.

@simonkeng
Copy link

simonkeng commented Jan 12, 2019

Also having this issue, for me, occasionally it will just hang on ⠸ Loading Game Schedule:

nba-go g

⠋ Loading Game Schedule(node:51577) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): FetchError: request to https://stats.nba.com/stats/teaminfocommon?LeagueID=00&Season=2018-19&SeasonType=Regular%20Season&TeamID=1610612755 failed, reason: read ETIMEDOUT
(node:51577) 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.
⠦ Loading Game Schedule

I'm using macOS High Sierra 10.13.4 17E202 x86_64 with iTerm2. @qorrect, I made the edit you recommended, but it didn't seem to work for me (although I'm not a regular npm user or node developer, so it's probably my lack of knowledge). I ran npm run build in nba-go/ but got this error:

$ npm run build

> [email protected] build /usr/local/lib/node_modules/nba-go
> npm run clean && webpack --config webpack.config.js -p


> [email protected] clean /usr/local/lib/node_modules/nba-go
> rimraf lib packed

internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module '/usr/local/lib/node_modules/nba-go/webpack.config.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at requireConfig (/usr/local/lib/node_modules/nba-go/node_modules/webpack/bin/convert-argv.js:97:18)
    at /usr/local/lib/node_modules/nba-go/node_modules/webpack/bin/convert-argv.js:104:17
    at Array.forEach (<anonymous>)
    at module.exports (/usr/local/lib/node_modules/nba-go/node_modules/webpack/bin/convert-argv.js:102:15)
    at yargs.parse (/usr/local/lib/node_modules/nba-go/node_modules/webpack/bin/webpack.js:171:41)
    at Object.Yargs.self.parse (/usr/local/lib/node_modules/nba-go/node_modules/yargs/yargs.js:533:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `npm run clean && webpack --config webpack.config.js -p`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I'm using node v10.15.0, npm 6.4.1, NBA GO version: 0.4.0. Thanks!

@qharlie
Copy link

qharlie commented Jan 12, 2019

@simonkeng this is how im building

  • Clone the repository to ~/nba-go
  • in ~/nba-go run : npm install
  • Now youd have to edit that dependency in node_modules/nba-stats-client , this needs to be fixed in that lib properly to work
  • run npm run build
  • now the build is in lib/cli.js , run with node lib/cli.js g -y

@simonkeng
Copy link

simonkeng commented Jan 12, 2019

Hi @qorrect, thanks so much for showing me the steps you took! I went through it and everything appeared to run properly, but mine is still hanging at Loading Game Schedule

Below is the edited code block I made in /nba-go/node_modules/nba-stats-client/build/NbaStatsClient.js

    key: 'getHeaders',
    value: function getHeaders() {
      return { 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',
        'referer': 'http://stats.nba.com/scores/', 'Connection': 'keep-alive', 'Accept-Language': 'en-US' };
    }

UPDATE:

It worked! Loading Game Schedule might take some time on the first go, but its much faster on successive runs. Thanks for your help @qorrect

@homerchen19 homerchen19 mentioned this issue Jan 15, 2019
@saeranv
Copy link

saeranv commented Mar 11, 2019

I'm having this problem as well. I'm trying to solve it with @qorrect's method, however it's failing at the npm install step, with the following message:

1016 silly lockFile 4fd6d666-blessed-0-1-81 blessed@^0.1.81
1017 silly lockFile 4fd6d666-blessed-0-1-81 blessed@^0.1.81
1018 error Error: CERT_UNTRUSTED
1018 error     at SecurePair.<anonymous> (tls.js:1370:32)
1018 error     at SecurePair.EventEmitter.emit (events.js:92:17)
1018 error     at SecurePair.maybeInitFinished (tls.js:982:10)
1018 error     at CleartextStream.read [as _read] (tls.js:469:13)
1018 error     at CleartextStream.Readable.read (_stream_readable.js:320:10)
1018 error     at EncryptedStream.write [as _write] (tls.js:366:25)
1018 error     at doWrite (_stream_writable.js:223:10)
1018 error     at writeOrBuffer (_stream_writable.js:213:5)
1018 error     at EncryptedStream.Writable.write (_stream_writable.js:180:11)
1018 error     at write (_stream_readable.js:583:24)
1018 error     at flow (_stream_readable.js:592:7)
1018 error     at Socket.pipeOnReadable (_stream_readable.js:624:5)
1019 error If you need help, you may report this log at:
1019 error     <http://github.com/isaacs/npm/issues>
1019 error or email it to:
1019 error     <[email protected]>
1020 error System Linux 4.9.125-linuxkit
1021 error command "/usr/bin/nodejs" "/usr/bin/npm" "install"
1022 error cwd /app/nba-go
1023 error node -v v0.10.25
1024 error npm -v 1.3.10
1025 verbose exit [ 1, true ]

Any ideas what could be wrong?

S

UPDATE:
As noted in the response below, this is an unrelated error. Serves me right for posting an issue without checking SO first. Attempting this again now.

@qharlie
Copy link

qharlie commented Mar 11, 2019

This is actually unrelated to the problem, its a build issue with NPM, googling on it seems to have found https://stackoverflow.com/questions/21855035/ssl-error-cert-untrusted-while-using-npm-command

@saeranv
Copy link

saeranv commented Mar 12, 2019

Okay, so having successfully followed @qorrect's instructions, now I'm running into this error when running node lib/cli.js g -y:

⠸ Loading Game Schedule...(4/6)

FetchError: request to https://stats.nba.com/stats/teaminfocommon?LeagueID=00&Season=2018-19&SeasonType=Regular%20Season&TeamID=1610612766 failed, reason: socket hang up

Oops, NBA.teamInfoCommon() goes wrong.
Please run nba-go again.
If it still does not work, feel free to open an issue on https://github.com/xxhomey19/nba-go/issues

I've run it twice and I'm getting the same message.

@qharlie
Copy link

qharlie commented Mar 12, 2019

You have an underlying SSL problem, Im guessing some sort of proxy - are you able to curl or wget that stats.nba.com url ?

@saeranv
Copy link

saeranv commented Mar 12, 2019

@qorrect, so I'm actually having intermittent success now. I would say 1/10 attempts is successful.

When it's not working, this is the error I'm getting when I try to wget the url (it hasn't been working in the last little bit so don't know what it's doing when it does work):

bash-4.3# wget http://stats.nba.com/stats/teaminfocommon?LeagueID=00&Season=2018-19&SeasonType=Regular%20Season&TeamID=1610612765
[1] 87
[2] 88
[3] 89
bash-4.3# Connecting to stats.nba.com (23.10.138.20:80)
wget: error getting response: Address not available

[1]   Exit 1                  wget http://stats.nba.com/stats/teaminfocommon?LeagueID=00
[2]-  Done                    Season=2018-19
[3]+  Done                    SeasonType=Regular%20Season

Edit: I hope I'm not making a really obvious, newbie mistake here, but I am also running all of this through docker. Could that be what's contributing to the SSL problem?

UPDATE

Got it working! For some reason, running node lib/cli.js g -y with the -y flag was causing the problem described above, but simply removing it (i.e node lib/cli.js g) has eliminated the problem, and it's now consistently, and quickly loading correctly.

Argh nevermind, just tested it again and this was not the cause. I think my connection just synced to my tests. I'm puzzled at how erratically this problem seems to appear and disappear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants