The migration from Server to Cloud stops during the analysis phase
Problem
The Server logs might show an error similar to:
com.botronsoft.jira.cloudmigrator.impl.errorhandling.CloudOperationException: The action failed due to a technical issue on our end.While the Cloud logs (visible to the Appfire Support team) may show something like this:
Stack Trace
com.botronsoft.jira.cloud.client.api.CloudClientException: Request failed! Url=Request{method=POST, url=https://{customer_organization}.atlassian.net//rest/api//3/workflows?expand=workflows.usages, headers=[X-Force-Accept-Language:true, Accept-Language:en]}
Request body: {"projectAndIssueTypes":[],"workflowIds":[],"workflowNames":["workflow1","workflow2","Workflow3", ...]}
Response code: 500
Response Body: {"errorMessages":["encountered an unexpected condition."],"errors":{}}
...Solution
The Configuration Manager Cloud app error indicates a workflow (or workflows) is broken, stopping the migration. To find which workflow (or workflows) is causing this, we can follow the workaround below:
Workaround 1:
Run the following API call in a terminal for each of the workflows mentioned in the CMJ cloud error log above:
curl -H "Content-Type: application/json" -X POST -d '{"projectAndIssueTypes":[],"workflowIds":[],"workflowNames":["<WORKFLOW_NAME>"]}' --user "<USER_NAME>:<USER_API_KEY>" "https://{customer_organization}.atlassian.net/rest/api/3/workflows?expand=workflows.usages"
Workaround 2:
Run the following python3 script to review each of the workflows from the CMJ cloud error log above at once:
import requests
from requests.auth import HTTPBasicAuth
import json
# Set the API endpoint site
site = "https://{customer_organization}.atlassian.net/"
auth = HTTPBasicAuth("<USER_NAME>", "<USER_API_KEY>")
# Set the headers for the request
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
#Here goes each of the workflow names.
workflow_name = ["workflow1","workflow2","Workflow3", ...]
#Iteration on the workflows to check them
for x in workflow_name:
print("----------")
print(f'Processing api call: {x}')
url = f'{site}rest/api/3/workflows?expand=workflows.usages'
payload = json.dumps( {
"projectAndIssueTypes": [],
"workflowIds": [],
"workflowNames": [x]
} )
response = requests.request("POST", url, data=payload, headers=headers, auth=auth)
print(response)
if response.status_code == 200:
print(f'Success first api call: {x}')
else:
print(f'Error first api call: {x}')
# api call completedNote: When the response code is 500, it means that the workflow is broken and should be removed from the Cloud instance.
Output example:
----------
Processing api call: workflow1
<Response [200]>
Success first api call: workflow1
----------
Processing api call: workflow2
<Response [500]>
Error first api call: workflow2
----------
All workflows listed in the error message should be checked; it does not matter if the workflow is not part of the project that is being migrated.