Read timed out error when trying to sync JIRA stories

When you try to sync external user stories from the project record, sometimes, the job will fail because of the 'Read timed out' error.

You can verify the status of the job by going to Setup > Apex Jobs
If the job fails, the same will be mentioned in the 'Status' column and the reason will be mentioned in the 'Status Detail' column:

Read Timed out error displayed in Apex Jobs

This is an intermittent issue. 

By default HTTP callout timeout is 10 seconds in Apex (link).
If the Jira does not return the response in 10 seconds, then Salesforce throws 'Read timed out' error. It may happen due to network, response size, etc.


To overcome this issue, timeout can be increased in the code. You have to access the apex class 'CopadoCCMutilities', search for below line:

Add below line after this:

CopadoCCMutilities class update

This is the maximum that can be set which is 2 minutes. (You can update the class in a sandbox and deploy to production)

How did we do?