JIRA REST API - Cannot perform GET - SocketTimeoutException

nikhilbhaskar December 8, 2017

I am trying to GET projects. I requested an request token, which I then used to request an access token, which I got successfully. 

However, when I GET projects ("https://ethtask.atlassian.net/rest/api/2/project"), I get a java.net.SocketTimeoutException.

On the JIRA side, I configured my application to have http://127.0.0.1:8000 as the Application URL and the Display URL.

Moreover, I know my Public-Private key pair is fine because I can successfully authenticate.

Here is how I am sending the GET request. It's through NodeJS, making use of the `oauth` npm module

app.get('/projects', function(req, res) {
  var base_url = 'https://ethtask.atlassian.net';
  var consumer = new OAuth(
    base_url + '/plugins/servlet/oauth/request-token',
    base_url + '/plugins/servlet/oauth/access-token',
    'ethtaskkey',
    fs.readFileSync('jira.pem', 'utf8'),
    '1.0',
    'http://localhost:8000/jira/callback',
    'RSA-SHA1'
  );
  function callback(error, data, resp) {
      console.log('data,', data);
      return res.send(data);
  }
  consumer.get(base_url + '/rest/api/2/project',
    authToken,
    authSecret,
    callback
  );
});

 

I confirmed that this works with curl

curl -D- -u nikhil38@gmail.com -X GET -H "Content-Type: application/json" https://ethtask.atlassian.net/rest/api/2/project

Enter host password for user 'nikhil38@gmail.com':
HTTP/2 200
server: Atlassian Proxy/0.1.152
vary: Accept-Encoding
atl-vtm-backend-time: 2231
cache-control: no-cache, no-store, no-transform
content-type: application/json;charset=UTF-8
strict-transport-security: max-age=315360000; includeSubDomains; preload
date: Fri, 08 Dec 2017 23:56:40 GMT
x-arequestid: 960d9ab8-0d3a-4dad-9832-7df3db8f2423
atl-vtm-time: 2231
x-ausername: admin
x-content-type-options: nosniff
set-cookie: atlassian.xsrf.token=1f623ef9-3678-417f-a078-0725541c2f7c|cdddee6e054105591ea991a1889f487f52e1aaa9|lin; Path=/; Secure
x-seraph-loginreason: OK
content-length: 568
atl-vtm-queue-time: 0

[{"expand":"description,lead,issueTypes,url,projectKeys","self":"https://ethtask.atlassian.net/rest/api/2/project/10000","id":"10000","key":"LB","name":"Launch Beta","avatarUrls":{"48x48":"https://ethtask.atlassian.net/secure/projectavatar?avatarId=10324","24x24":"https://ethtask.atlassian.net/secure/projectavatar?size=small&avatarId=10324","16x16":"https://ethtask.atlassian.net/secure/projectavatar?size=xsmall&avatarId=10324","32x32":"https://ethtask.atlassian.net/secure/projectavatar?size=medium&avatarId=10324"},"projectTypeKey":"software","simplified":false}]



Here's a portion of the error log

java.net.SocketTimeoutException
java.net.SocketTimeoutException
at org.apache.tomcat.util.net.NioBlockingSelector.read(NioBlockingSelector.java:202) [tomcat-coyote.jar:8.0.38]
at org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:250) [tomcat-coyote.jar:8.0.38]
at org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:231) [tomcat-coyote.jar:8.0.38]
at org.apache.coyote.http11.InternalNioInputBuffer.fill(InternalNioInputBuffer.java:133) [tomcat-coyote.jar:8.0.38]

1 answer

0 votes
Pragatheeswaran August 13, 2018

Have you found any solution for this?

Suggest an answer

Log in or Sign up to answer