Auto generated Amplify ManyToMany table - Unable to serialize `2023-06-12T01:48:00.288432` as a valid DateTime Object

22 Views Asked by At

I am currently making a project with AWS Amplify. I have made my graphql schema such that there is a manyToMany connection between two models. I have a function that creates a review, then creates a connection between an Artist and the Review.

Basically, I am able to create an instance of one of models, for example, creating an review or an artist, but when I try to make a manyToMany connection I get the following error: Can't serialize value (/createArtistToReviews/artist/updatedAt) : Unable to serialize 2023-06-12T01:48:00.288432 as a valid DateTime Object.", It is actually able to create the the ArtistToReview, but it throws this error after it creates it.

I have checked this question on stacOverflow which is similar, but the problem in my case is that I can't access the ArtistToReview table, as it is autogenerated by Amplify.

This is a preview of my schema:

type Review @model @auth(rules: [{allow: owner, operations: [create, read, update, delete]}, {allow: public, operations: [read]}, {allow: private, provider: iam, operations: [read]}]) {
  id: ID! 
  artist: [Artist!]! @manyToMany(relationName: "artistToReviews")
  artistName: [String!]!
  artistId: [String!]!
  content: String
  year: Int!
  userId: ID @index(name: "byUser", queryField: "byUser", sortKeyFields:["year"])
}

type Artist @model @searchable @auth(rules: [{allow: public, provider: iam, operations: [read]}, {allow: private}]) {
  id: ID!
  name: String!
  image: String
  reviews: [Review] @manyToMany(relationName: "artistToReviews")
}
0

There are 0 best solutions below