JIRA REST API - Cannot perform GET - SocketTimeoutException

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

Have you found any solution for this?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

24,081 views 2 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you