0

shown below is the graphql Schema.

@auth(rules: [{ allow: owner,operations: [create, delete ] ,ownerField: "user"}])
{
  id: ID!
  videoKey: String!
  videoThumbnailKey :String!
  videoTitle:String!
  videoDescription:String!
  channelName:String!
  videoLikes: Int
  videoDislikes: Int
  comments: [Comment] @connection(keyName: "byVideo", fields: ["id"])
  user: String
}
 
type Comment @model
@auth(rules: [{ allow: owner,operations: [create,delete] ,ownerField: "user"}])
  @key(name: "byVideo", fields: ["videoID", "comment"]) {
  id: ID!
  videoID: ID!
  comment: String!
  video: Video @connection(fields: ["videoID"])
  user: String
}

type LikedVideos @model
{
  id:ID!
  video:[Video]@connection
}

this is the query for listing videos

list video query

and these are the results

list video query results

this is the query for getting a video

get video query

and these are the results

get video query result

all of these works fine, but when I try to delete it I get error. this is the mutation query

delete video mutation

and this is the error response i got

delete video mutation result here

2 Answers2

0

Seems like you have not added sort key in dynamo db table and the other items have the same primary key as of first item. I faced similar issue and worked after adding sort key.

Madhav
  • 71
  • 7
0

This seems to be another bug in AWS Amplify or local DynamoDB.

I am using the same schema - when I add even just a space to schema.grapql, first delete operation works. The delete operations executed after are not working.

Also, it seems like something is throttling query response (I am using amplify mock command): E.g. I have 7 items in the database and when I am trying to list all of them, I got responses with 1, 2, or even zero items, multiple times - when I would expect, that they will be loaded in 1 request, at the same time.

I am using AWS Amplify

 "aws-amplify": "^3.1.1",
 "aws-amplify-react-native": "^4.2.5",

Even if you modify schema.graphql, it's still unreliable.

Stefan Majiros
  • 444
  • 7
  • 11