question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTTP response code -1 when creating authentication token

See original GitHub issue

Describe 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:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bitwisemancommented, Mar 30, 2020

Thanks!

This is the source of the problem:

Caused by: java.net.ConnectException: 拒绝连接 (Connection refused)
	at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_242]

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.

0reactions
bitwisemancommented, Jun 7, 2020

@DeKaiju github-branch-source now uses okhttp3 for App token retrieval. It fixes your issue. Please respond if it occurs again.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found