It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JIRA Rest Api - Status Code: 0 Error Message:The underlying connection was closed: An unexpected error occurred on a send.

Two weeks before we had an authorization issue for API,as the JIRA Key got expired. We have updated the new key in Production config file. Since then, we have been facing this issue and after analysis we got the "Underlying connection closed " which is the actual error. I have also tried with Application Pool restart in Production servers, but still the same result. 

But the same API works fine in localmachine  using PostMan(REST Client) and in stage server as well. This api fails only in production server.

 

we are using C#.Net - Rest Client to call JIRA API, below are the details

try
            {
                RestClient client = new RestClient(ConfigurationManager.AppSettings["JiraUri"]);
                RestRequest request = new RestRequest(resource, method);
                request.AddHeader("Authorization", "Basic " + JiraAuthentication);
                request.AddHeader("Content-Type", "application/json");
                request.AddHeader("Accept", "application/json");
                request.RequestFormat = DataFormat.Json;
                if (requestBody != null)
                {
                    request.AddBody(requestBody);
                }
                var response = client.Execute<T>(request);
                if(response.StatusCode == System.Net.HttpStatusCode.OK && response.Data != null)
                    return response.Data;
                else
                {
                    emailBody += "Status Code: " + response.StatusCode + "\n Error Message:" + response.ErrorMessage + "\n";
                    SendEmail("Admin@xxxx.com", "firstName.lastName@trane.com", "Error in accesing JIRA API", emailBody);
                    throw new Exception(response.ErrorMessage);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

The Sample URI is as below:

https://projectName.jira.com/rest/api/2/issue/AVC-3173

Error we get when we call JIRA API:

Status Code: 0

Error Message:The underlying connection was closed: An unexpected error occurred on a send.

 

Please help me in fixing this issue.

 

1 answer

Code 0 means that there is no response. Check:

  • Firewall restrictions for booth directions: can Java make outgoing requests and are the incoming requests enabled on the destination server.
  • For troubleshooting you may try to make the call from the server using some tool like mentioned PostMan.

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

880 views 7 0
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you