Unable to serialise AWSDate from RDS in AppSync response mapping template


I’m building an AppSync project using serverless Aurora as my db, and stumbled across this strange error:

This happens when I get a User object which looks like this:

The error seems to be happening because $utils.rds.toJsonObject($ctx.result)[0][0] can’t parse an AWSDateTime. Which makes anything with a date impossible to serve from the database.

If I simply select the object without dates ["SELECT id,name,description FROM Users WHERE id='$ctx.args.id'"] it works fine.

So how should dates be handled in AWS AppSync and Aurora? I have been unable to find any example or reference to handling dates in the documentation. 🙁


I accidentally found the answer in a repo connected to this question Use AppSync and Amazon RDS with serverless-graphql

It turns out, like user dev1702 discovered, that $utils.rds.toJsonObject($ctx.result)[0][0] cannot parse a RDS Timestampt INTO an GraphQl AWSDate format.

So simply changing the graphql schema type from:

created_at: AWSDateTime


created_at: String

solves this issue.

A Note: If you are facing this error after changing your scheme column type to AWSDateTime, just visit the DynamoDB console and update records that do not in the format of ISO 8601.

Leave a Reply