admin管理员组

文章数量:1202337

Below is the payload I am sending to the API Gateway where mapping templates are configured for returning response:

{
    "changeType": "created",
    "notificationUrl": ".1.1/ingestion",
    "resource": "users/f5bc9f8b-d638-4da5-aa8b-a4d79350f33c/messages",
    "expirationDateTime": "2025-01-23T07:23:45.9356913Z",
    "clientState": "zxcvqqbnmm"
}

When I send this request, I receive the following error response:

{
    "error": {
        "code": "ValidationError",
        "message": "The request is invalid due to validation error.",
        "innerError": {
            "date": "2025-01-22T07:06:40",
            "request-id": "e50950bd-c1f8-483d-94c3-a3a6b8c6ab51",
            "client-request-id": "e50950bd-c1f8-483d-94c3-a3a6b8c6ab51"
        }
    }
}

Mapping template configured as follows:

#set($token = $input.params('validationToken').trim())
#set($token = "$input.params('validationToken')")
#if($token.length() > 2)
    #set($context.responseOverride.status = 200)
    #set($context.responseOverride.content-type = "text/plain")
    #set($context.requestOverride.path.body = "$token")
  {
    "headers": {
      "Content-Type": "application/json"
    },
    "status": 200,
    "body": {
      "validationToken": "$token"
    },
    "StreamName": "notifications-ingestion-stream",
    "Records": [
      {
        "Data": "$util.base64Encode($token)",
        "PartitionKey": "token.token.token"
      }
    ]
  }
Response Template

#set($body = $context.requestOverride.path.body)
$body

I suspect the error might be due to the way the validationToken is handled or returned in the mapping template. Has anyone encountered this issue or have suggestions for debugging it?

Any help would be greatly appreciated!

本文标签: