Share via

{"error":{"code":"InvalidRequestContent","message":"The request content is not valid and could not be deserialized: 'After parsing a value an unexpected character was encountered: M. Path 'CaptureError', line 8, position 21.'."}}

Mahesh PR 0 Reputation points
2023-08-18T18:37:23.6666667+00:00

Getting this error - {"error":{"code":"InvalidRequestContent","message":"The request content is not valid and could not be deserialized: 'After parsing a value an unexpected character was encountered: M. Path 'CaptureError', line 8, position 21.'."}}

Below is the workflow code

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Send_email_(Preview)": {
                "inputs": {
                    "body": {
                        "content": {
                            "html": "<p style=\"font-family: 'Trebuchet MS'; font-size: 13px; line-height: 1;\">\"@{triggerBody()?['GroupName']}\"-\"@{triggerBody()?['RunSeqName']}\"- ADF job is failed / suspended due to faults or errors. Please check ADF monitor or Status Log table for more details.</p><p style=\"font-family: 'Trebuchet MS'; font-size: 13px; line-height: 1;\"><b><strong>Group ID: </strong></b>@{triggerBody()?['GroupId']}</p><p style=\"font-family: 'Trebuchet MS'; font-size: 13px; line-height: 1;\"><b><strong>Job: </strong></b>@{triggerBody()?['GroupName']}</p><p style=\"font-family: 'Trebuchet MS'; font-size: 13px; line-height: 1;\"><b><strong>Session: </strong></b>@{triggerBody()?['RunSeqName']}</p><p style=\"font-family: 'Trebuchet MS'; font-size: 13px; line-height: 1;\"><b><strong>Sequence Number: </strong></b>@{triggerBody()?['RunSeq']}</p><p style=\"font-family: 'Trebuchet MS'; font-size: 13px; line-height: 1;\"><b><strong>Error: </strong></b><span style=\"color: red;\">@{base64(triggerBody()?['CaptureError'])}</span></p>",
                            "subject": "\"'@{triggerBody()?['GroupName']}' - '@{triggerBody()?['RunSeqName']}'\" ADF job failed"
                        },
                        "importance": "high",
                        "recipients": {
                            "to": [
                                {
                                    "email": "******@email.com"
                                }
                            ]
                        },
                        "sender": "******@9e8338.azure.net"
                    },
                    "host": {
                        "connection": {
                            "referenceName": "acsemail-2"
                        }
                    },
                    "method": "post",
                    "path": "/emails:send",
                    "queries": {
                        "api-version": "2021-10-01-preview"
                    }
                },
                "runAfter": {},
                "trackedProperties": {},
                "type": "ApiConnection"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "triggers": {
            "When_a_HTTP_request_is_received": {
                "inputs": {
                    "schema": {
                        "properties": {
                            "CaptureError": {
                                "type": "string"
                            },
                            "GroupId": {
                                "type": "string"
                            },
                            "GroupName": {
                                "type": "string"
                            },
                            "RunSeq": {
                                "type": "integer"
                            },
                            "RunSeqName": {
                                "type": "string"
                            }
                        },
                        "type": "object"
                    }
                },
                "kind": "Http",
                "type": "Request"
            }
        }
    },
    "kind": "Stateful"
}

Azure Logic Apps
Azure Logic Apps

An Azure service that automates the access and use of data across clouds without writing code.

Azure Data Factory
Azure Data Factory

An Azure service for ingesting, preparing, and transforming data at scale.


1 answer

Sort by: Most helpful
  1. Mike Urnun 9,792 Reputation points Moderator
    2023-08-18T21:37:32.9233333+00:00

    Hello @Mahesh PR - Thanks for reaching out! Are you sending a valid JSON payload with a Content-type: application/json header? You have defined the JSON schema below in the Request action to match the Body of the incoming request:

    "properties": {
            "CaptureError": {
                "type": "string"
            },
            "GroupId": {
                "type": "string"
            },
            "GroupName": {
                "type": "string"
            },
            "RunSeq": {
                "type": "string"
            },
            "RunSeqName": {
                "type": "string"
            }
        }
    

    This makes the Request trigger expect the payload in incoming requests to be a data type of JSON along with a Content-type: application/json header. However, If you're invoking the request with the Content-type: application/json header but sending a payload that's not a valid JSON, you'll hit the error below:

    {
        "error": {
            "code": "InvalidRequestContent",
            "message": "The request content is not valid and could not be deserialized: 'Unexpected character encountered while parsing value: a. Path '', line 0, position 0.'."
        }
    }
    

    Could you verify if the payload is a valid JSON, and let us know if the issue persists?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.