[英]AWS Lambda function unable to access AppSync GraphQL API - permission denied
[英]Calling AWS AppSync graphql API from Lambda
I am trying to update the value of a table using the AWS-app sync graphql API, I am able to create data and add it in a table using graphql mutation in lambda but when I am trying to update the data its not working. 我從 API 網關調用此 lambda 服務。
我將這篇文章稱為代碼https://cloudonaut.io/calling-appsync-graphql-from-lambda/
我想提到git 雲手表日志沒有錯誤
這是我的 graphql 的架構
type Mutation {
createLib_content(input: CreateLib_contentInput!): lib_content
@aws_iam
updateLib_content(input: UpdateLib_contentInput!): lib_content
@aws_iam
deleteLib_content(input: DeleteLib_contentInput!): lib_content
}
input CreateLib_contentInput {
content: String
userId: String
}
input UpdateLib_contentInput {
content: String
id: ID!
}
創建突變
graphqlData = await clientDetails.mutate({
mutation: gql(`
mutation CreateLibContent($input: CreateLib_contentInput!) {
createLib_content(input: $input) {
id
content
}
}`),
variables: {
input: {
content : {},
userId : identitiesDetails.userId
}
},
});
更新突變
const mutation = gql(`
mutation UpdateLibContent($input: UpdateLib_contentInput!) {
updateLib_content(input: $input) {
userId
content
}
}`);
await clientDetails.mutate({
mutation,
variables: {
input: {
id : "2947c37e-6f76-40d8-8c10-4cd6190d3597",
content : JSON.stringify(event)
}
}
}).promise;
感謝@cppgnlearner,您的猜測是正確的。
我剛剛從我的更新代碼中刪除了.promise 它開始工作了。
不敢相信這么小的事情花了我一整天。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.