API Gateway Rest Endpoint "MalformedQueryString" (worked prior for 1 month)


Hi, I have had an API gateway running as a webhook receiver -> SQS for a little over a month with no issues. As of 9/26, I started receiving an error on all requests on my only endpoint for this API two days ago.

    "Error": {
        "Code": "MalformedQueryString",
        "Message": "Keys may not contain  ",
        "Type": "Sender"
    "RequestId": "XXXXX"

This is the end points def in template.

        statusCode: "200"
      integration.request.header.Content-Type: "'application/x-www-form-urlencoded'"
      application/json: "Action=SendMessage&MessageBody=$input.body"
    passthroughBehavior: "never"
    type: "aws"

Issue I am having is that the message body to the API is always truncated, with no discernable difference in the first 1024kb of the data with historical vs new messages that are failing. I can only assume after the first 1024kb of data, there must be a difference in the message being received? How do I troubleshoot this further?

1 Answer

I was able to isolate the issue. A field contained an ampersand "&" in the message being put into body. changing ampersands to "and" in the DB and that did the trick...not sure why this was an issue, or if this was ultimately the final cause (it could be the 3rd parties webhook that sends the initial message doesn't handle the ampersand well). That would be my first guess but I do not have the time to dig any further or point test SQS to find out!

answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions