Skip to content
This repository has been archived by the owner on Apr 30, 2019. It is now read-only.

TSD, Github 401 Unauthorized #261

Open
Djeg opened this issue Jan 7, 2016 · 3 comments
Open

TSD, Github 401 Unauthorized #261

Djeg opened this issue Jan 7, 2016 · 3 comments

Comments

@Djeg
Copy link

Djeg commented Jan 7, 2016

Hello,

I have a currious error, my .tsdrc contains the following lines :

{
    "token": "my_token"
}

And this file is located at the root directory of my app. When I do a tsd rate i got:

 > rate-limit 37 / 60 -> 0:33:56

And when i run tsd install i have a 401 error code on github API. This is my tsd-debug.log file:

[ERR!] cwd  : /home/djeg/Project/ca-production-center-front
[ERR!] os   : Linux 3.19.0-41-generic
[ERR!] argv : "/usr/local/bin/node" "/usr/local/bin/tsd" "install"
[ERR!] node : v5.0.0
[ERR!] tsd  : 0.6.5
[ERR!] Error: unexpected status code: 401 on: https://api.github.com/repos/borisyankov/DefinitelyTyped/branches/master
[ERR!] CODE : undefined
[ERR!] unexpected status code: 401 on: https://api.github.com/repos/borisyankov/DefinitelyTyped/branches/master
[ERR!] If you need help, you may report this error at:
    https://github.com/DefinitelyTyped/tsd/issues

[ERR!] 
Error: unexpected status code: 401 on: https://api.github.com/repos/borisyankov/DefinitelyTyped/branches/master
    at Request.<anonymous> (/usr/local/lib/node_modules/tsd/build/http/CacheStreamLoader.js:162:28)
    at emitOne (events.js:77:13)
    at Request.emit (events.js:169:7)
    at Request.onRequestResponse (/usr/local/lib/node_modules/tsd/node_modules/request/request.js:951:10)
    at emitOne (events.js:77:13)
    at ClientRequest.emit (events.js:169:7)
    at HTTPParser.parserOnIncomingClient (_http_client.js:421:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)
    at TLSSocket.socketOnData (_http_client.js:311:20)
    at emitOne (events.js:77:13)

[ERR!] tsd.json: {"version":"v4","repo":"borisyankov/DefinitelyTyped","ref":"master","path":"typings","bundle":"typings/tsd.d.ts","installed":{"angularjs/angular.d.ts":{"commit":"81b951f1ac437d1eb5ff5171a0bfa6c467634b13"},"jquery/jquery.d.ts":{"commit":"81b951f1ac437d1eb5ff5171a0bfa6c467634b13"},"angularjs/angular-route.d.ts":{"commit":"81b951f1ac437d1eb5ff5171a0bfa6c467634b13"}}}

[ERR!] .tsdrc : {
    "token": "my_token"
}


[ERR!] Please include the following file with any support request:
    /home/djeg/Project/ca-production-center-front/tsd-debug.log

I just change the value of the token is those exemples.

Everything goes well when i remove the tsdrc file, except that i reach the API Rate limit :/. It look like my token isn't read by tsd ? Any idea ?

@ElaineYu
Copy link

I'm experiencing the same error when I've included new .tsdrc file with new Github Token.

@kenhowardpdx
Copy link

I've been fighting with this too but I'm not convinced it's a TSD_GITHUB_TOKEN bug. I'm pushing my repo to heroku and my npm install runs tsd reinstall. The first error is that tsd can't cwd into the project directory. This makes me think it's a permissions issue, but I'm not sure how to debug.

I'm also using codeship for CI and it has no problems installing TSD definitions.

@kenhowardpdx
Copy link

I've solved my issue. The problem was I had revoked a token in GitHub that Heroku was using. Codeship was using a different token so it was passing. I changed the heroku token to match the codeship token and things are working as expected.

I'm not sure this will help anyone else, but make sure your token is correct.

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

No branches or pull requests

3 participants