HTTP response code -1 when creating authentication token
See original GitHub issueDescribe the bug
Sometimes I’ll get a message like org.kohsuke.github.HttpException: Server returned HTTP response code: -1, message: 'null' for URL: https://api.github.com/app
when creating the installation token here. This does not always happen, but when it happens, I just need to wait for a while and re-try, then it will successfully return the token. I tried to use Apache HTTP Client to make the requests without this library, and it never happens.
To Reproduce
Just try to create an installation token using an authenticated GitHub
with JWT token may reproduce this, but not always although you haven’t change anything at all.
Expected behavior Returns an installation token.
Desktop (please complete the following information):
- OS: Ubuntu
- Version: 18.04
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
HTTP response code -1 when creating authentication token
I tried to use Apache HTTP Client to make the requests without this library, and it never happens. ... Just try to create...
Read more >HTTP response status codes - MDN Web Docs - Mozilla
HTTP response status codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped in five classes:
Read more >Access Token Error Response and Codes - Tutorialspoint
This error code is mainly used when 500 internal server cannot be returned to the client by using HTTP redirect. It specifies that...
Read more >HTTP Status Codes - REST API Tutorial
This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty...
Read more >OAuth HTTP error response reference | Apigee Edge
OAuth HTTP error response reference ; Authorization Code. Invalid Redirect URI ; Generate AccessToken. Invalid Auth Code ; Implicit. Invalid Client ID ;...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks!
This is the source of the problem:
ConnectException
in known to be a transient issue which we automatically retry:https://github.com/github-api/github-api/blob/dd55e8a22c0c828b60a26f98e8a088d77188f747/src/main/java/org/kohsuke/github/GitHubClient.java#L360-L366
https://github.com/github-api/github-api/blob/dd55e8a22c0c828b60a26f98e8a088d77188f747/src/main/java/org/kohsuke/github/GitHubClient.java#L458-L474
The only way you should see that error is if you get it 3 times. Do your logs show the retries happening before the exception is thrown? If so, I’m not sure what more we can do on this level. You might try using
extras.okhttp3.OkHttpConnector
or it sounds like the Apache Client also fixes this.@DeKaiju github-branch-source now uses okhttp3 for App token retrieval. It fixes your issue. Please respond if it occurs again.