嗨,我是 aws AppSync 和 GraphQl 的新手。我有订阅问题。我想在发布新帖子时实时收到通知
这是我的 graphql 架构 ``
type Mutation {
addPost(
id: ID!,
author: String!,
title: String,
contennt: String,
url: String
): Post!
updatePost(
id: ID!,
author: String!,
title: String,
content: String,
ups: Int!
): Post!
deletePost(id: ID): Post!
}
type Post {
id: ID!
author: String!
title: String!
url: String
content: String
ups: Int!
}
type Query {
allPost: [Post]
getPost(id: ID!): Post
}
type Subscription {
newPost: Post
@aws_subscribe(mutations: ["addPost"])
}
schema {
query: Query
mutation: Mutation
subscription: Subscription
}
``
这是我对潜艇的查询:
subscription NewPostSub{
newPost{
__typename
title
content
author
url
}
}
我收到错误,提供的关键元素与模式不匹配,在 dynamodb 表中 pk 是 id 并且我生成了映射模板。谢谢