maxime
maxime

Reputation: 2315

AppSync resolver: Trailing characters at the end of the JSON string are not allowed

When creating a custom AppSync resolver, it is saved and well deployed but when I request the API I get this response.

I have absolutely no chars after the last bracket. What's wrong ?

{
  "data": null,
  "errors": [
    {
      "path": [
        "listUsers"
      ],
      "data": null,
      "errorType": "MappingTemplate",
      "errorInfo": null,
      "locations": [
        {
          "line": 2,
          "column": 3,
          "sourceName": null
        }
      ],
      "message": "Trailing characters at the end of the JSON string are not allowed."
    }
  ]
}

Upvotes: 1

Views: 2908

Answers (2)

Dr Douglas GhD
Dr Douglas GhD

Reputation: 1099

I can confirm that this error happens when a rogue character in your Velocity template.

Somehow I copied and pasted the template into my cloud formation template with a curly bracket at the end.

Thanks to this question I found it.

Upvotes: 0

maxime
maxime

Reputation: 2315

My bad, I only had a duplicate bracket in my mapping template. The console doesn't tell anything for these cases and you only have the error at runtime.

Upvotes: 2

Related Questions