Azure Pipelines gate failing, SN API not returning JSON

toledotown
Kilo Explorer

We have setup the Azure DevOps and SN integration.

Azure DevOps is complaining that the SN API is not returning JSON. Can anyone provide guidance?

The error below is on the ADO Pipeline:

 

============================================================================== 
Task         : ServiceNow change management
Description  : Gate on status of new change request or an existing change request in ServiceNow.
Version      : 1.150.0
Author       : Microsoft
Help         : 
============================================================================== 
2019-09-13T14:26:58.6739793Z POST https://xxxxxx.service-now.com//api/now/import/x_mioms_azpipeline_change_request_import
Request body: {
  "u_correlation_id": "xxxxxxxxxxxxxxxxxxxxx",
  "u_type": "Normal",
  "u_x_mioms_azpi_eline_metadata": "Release: https://dev.azure.com/xxxxxxxxxx/xxxxxxx/_release?releaseId=9&_a=release-summary 
 EnvironmentName: Production 
 Requested By : xxxxxxxxx",
  "u_short_description": "Deployment to Production of Release Release-9",
  "u_description": "Deployment to Production of Release Release-9",
  "u_requested_by_date": "2019-09-13 14:11:35",
  "u_start_date": "2019-09-13 12:00:00",
  "u_end_date": "2019-09-13 14:00:00"
}
				Response Code: 0
				Response: An error was encountered while processing request. Exception: 
Exception Message: The request timed out after 20 seconds as no response was received. (type TimeoutException)
				Evaluation of expression 'eq(jsonpath('$.result[0].status')[0], 'inserted')' failed.
				
Exception Message: Error parsing API response into a JSON object. (type DistributedTaskException)
5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

the json doesn't look valid that is the reason they are complaining

see screenshot below; issue is because of this "Release: i.e. extra key within the value

what it the value in the field u_x_mioms_azpi_eline_metadata in that table for that record?

find_real_file.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thank you for the reply. I believe that is due to the log output have new lines breaking the string attribute, not the actual call. The new lines in the "u_x_mioms_...." property break the json. However, we know the request is successful since the CR gets created. It is the response from the API when creating the CR that is breaking the process. Azure Pipelines is expecting JSON to be returned which includes the CR number. The Azure Pipelines plugin is unable to parse the JSON response.

 

Or perhaps the issue no response is received at all...

 

Exception Message: The request timed out after 20 seconds as no response was received.

toledotown
Kilo Explorer

I believe the problem lies with the Azure DevOps plugin. I tested this API in the ServiceNow API explorer and returns valid JSON with the CR number. I will update this post once resolve by Microsoft.

Did you check this?

https://github.com/Microsoft/azure-pipelines-tasks/issues/8655


Please mark my response as correct and helpful if it helped solved your question.
-Thanks