question

HemantSudehely-0557 avatar image
1 Vote"
HemantSudehely-0557 asked ·

Logic App not able to deserialized Azure data factory pipeline error message

Hi,

I am facing the below issue with Azure Data Factory using Logic App.

I am using the Azure Data Factory pipeline for migration and Logic App for sending "Success & Failure" notification to the technical team.
Now success is working fine as the message is hardcoded, but failure is not as the Logic App web activity is not able to parse data factory pipeline error.

Here is the input that is going to Logic App web activity
Input
{
"url": "https://xxxxxxxxxxxxxxxxx",
"method": "POST",
"headers": {},
"body": "{\n \"title\": \"PIPELINE RUN FAILED\",\n \"message\":\"Operation on target Migration Validation failed: Execution fail against sql server. Sql error number: 50000. Error Message: The DELETE statement conflicted with the REFERENCE constraint \"FK_cmclientapprovedproducts_cmlinkclientchannel\". The conflict occurred in database \"Core7\", table \"dbo.cmClientApprovedProducts\", column 'linkclientchannelid'.\",\n \"color\": \"Red\",\n \"dataFactoryName\": \"LFC-TO-MCP-ADF\",\n \"pipelineName\": \"LFC TO MCP MIGRATION\",\n \"pipelineRunId\": \"f4f84365-58f0-4da1-aa00-64c3a4daa9e1\",\n \"time\": \"2020-07-31T22:44:01.6477435Z\"\n}"
}

Here is the error logic app is throwing

failures
{
"errorCode": "2108",
"message": "{\"error\":{\"code\":\"InvalidRequestContent\",\"message\":\"The request content is not valid and could not be deserialized: 'After parsing a value an unexpected character was encountered: F. Path 'message', line 3, position 202.'.\"}}",
"failureType": "UserError",
"target": "Send Failed Notification",
"details": []
}

I have tried various options, like set variable and convert by using various existing methods (string, json, replace etc), but no luck
e.g @string(activity('LOS migration').Error.Message)
Struggling almost all day this...please suggest if anyone faced a similar issue...

Below is the data flow activity
14849-pipeline.png

14850-logic-app-parameters.png


azure-data-factoryazure-logic-appsazure-migrate
pipeline.png (59.7 KiB)
pipeline.png (59.7 KiB)
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

HarithaMaddi-MSFT avatar image
1 Vote"
HarithaMaddi-MSFT answered ·

Hi @HemantSudehely-0557,


Welcome to Microsoft Q&A Platform.


Below is an approach I used to get dynamic error messages in mail using Logic App from Azure Data Factory, it worked. If the issue persists, please share your pipeline run id to investigate further.
15080-logicappfailuremailadf.gif




· 11 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Haritha,

I am using the same approach but still the same issue, the logic app is not able to parse the error message.

Pipeline run id is - "243b0761-c94f-4043-bab6-a94c950aa9de"
15178-capture.png


Please help...

Here is the JSON body That is going to Logic APP
15223-input.png


0 Votes 0 ·
capture.png (45.0 KiB)
input.png (39.0 KiB)

I am also getting the same error message.

0 Votes 0 ·

Is there any update on this issue?

0 Votes 0 ·

Hi @HemantSudehely-0557 ,

Thanks for sharing the details. I am working with product team to get more insights on the issue and will update you once I hear back from them. Meanwhile, if not already tried, can you please check removing response activity in your pipeline and directly passing error message in Logic App as "@{activity('LOS migration').Error.Message}".

0 Votes 0 ·

I have already tried without response bypassing pipeline error message but still the same issue.

failures
{
"errorCode": "2108",
"message": "{\"error\":{\"code\":\"InvalidRequestContent\",\"message\":\"The request content is not valid and could not be deserialized: 'After parsing a value an unexpected character was encountered: F. Path 'message', line 3, position 202.'.\"}}",
"failureType": "UserError",
"target": "Send Failed Notification",
"details": []
}

0 Votes 0 ·
Show more comments
MarkZhukovsky-7004 avatar image
0 Votes"
MarkZhukovsky-7004 answered ·

For those coming here struggling with this terrible problem as I have for way longer than desired; for my case, I have found the solution, and I suspect it will work for many others.

The answer lies in the content of the JSON - if what you are passing in has DOUBLE QUOTES, they need to be replaced with SINGLE quotes. It is the only thing that worked for me.

E.g.:

 @string(replace(activity('Execute a failing Pipeline').error.message, '"',''''))

Note that these look identical because the first one is a double quote (what we are replacing) within single quotes, and the second one (what we are replacing it with) is an escaped single quote (i.e. two single quotes in a row) within single quotes.

What a nightmare. But finally got it to work.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.