aws-appsync

Aws Appsync $util.error: data and errorInfo always null

a 夏天 提交于 2019-12-21 21:04:41
问题 I am playing with AWS AppSync. I am trying to output some error details when the request fails using the $util.error() helper (Documented here) in my resolver's response mapping template. No matter what I do, I am not able to get AppSync to output the data and errorInfo fields in the error output. Here is the Lambda I have. exports.handler = (event, context, callback) => { callback(null, { data: { name: "Test", }, errorMessage: "Some error Message", errorType: "SomeErrorType", errors: { "foo"

Can AWS App-Sync be used without dynamoDB

六月ゝ 毕业季﹏ 提交于 2019-12-21 12:18:39
问题 I am interested in the offline and sync capabilities of Amazon's app-sync but I was wondering if it could be used without dynamoDB as the backend. The graphQL resolvers written in VTL for dynamoDB look atrocious. It seems it would be much nicer to use a mongo backend. Is that possible? 回答1: Yes, you can use AppSync without DynamoDB. You can use ElasticSearch out of the box (you will need to provision the ES cluster and then setup the resolvers) or you can use Lambda and pipe your data to any

Apollo - update() method getting called twice, both times with optimistic/fake data

吃可爱长大的小学妹 提交于 2019-12-21 07:13:17
问题 I'm completely stuck on an Apollo problem, for which I've opened a GitHub issue and had zero response on. I'm calling an Apollo mutation, using optimisticResponse . The way it's supposed to work, as I understand it, is that update() gets called twice: first with the optimistic data, then again with the actual data coming in from the network. But for some reason, my code is not working like this. I'm getting two update() calls, both with the optimistic data. Here's a repo that demonstrates

AWS AppSync: pass arguments from parent resolver to children

僤鯓⒐⒋嵵緔 提交于 2019-12-21 04:41:04
问题 In AWS AppSync, arguments send on the main query don't seem to be forwarded to all children resolvers. type Query { article(id: String!, consistentRead: Boolean): Article book(id: String!, consistentRead: Boolean): Book } type Article { title: String! id: String! } type Book { articleIds: [String]! articles: [Article]! id: String! } when I call: query GetBook { book(id: 123, consistentRead: true) { articles { title } } } the first query to get the book receives the consistentRead param in

AWS AppSync - Adding Global Secondary Index to DynamoDB and pagination using GSI sort key

扶醉桌前 提交于 2019-12-19 19:51:55
问题 I am trying to create a structure that lists comments for a post with postId ordered w.r.t. their lastChangeTime descending. The model in the schema is shared below. type Comment { id: ID! postId: String! user: String! lastChangeTime: String commentBody: String } It has a backing DynamoDB table and generic CRUD resolvers for it already. And id field is the primary key in the table. I plan to build a query as follows: { "version": "2017-02-28", "operation" : "Query", "index" : "postId-index",

AWS AppSync - Adding Global Secondary Index to DynamoDB and pagination using GSI sort key

青春壹個敷衍的年華 提交于 2019-12-19 19:51:36
问题 I am trying to create a structure that lists comments for a post with postId ordered w.r.t. their lastChangeTime descending. The model in the schema is shared below. type Comment { id: ID! postId: String! user: String! lastChangeTime: String commentBody: String } It has a backing DynamoDB table and generic CRUD resolvers for it already. And id field is the primary key in the table. I plan to build a query as follows: { "version": "2017-02-28", "operation" : "Query", "index" : "postId-index",

AppSync: Get user information in $context when using AWS_IAM auth

主宰稳场 提交于 2019-12-18 11:10:56
问题 In AppSync, when you use Cognito User Pools as your auth setting your identity you get identity: { sub: 'bcb5cd53-315a-40df-a41b-1db02a4c1bd9', issuer: 'https://cognito-idp.us-west-2.amazonaws.com/us-west-2_oicu812', username: 'skillet', claims: { sub: 'bcb5cd53-315a-40df-a41b-1db02a4c1bd9', aud: '7re1oap5fhm3ngpje9r81vgpoe', email_verified: true, event_id: 'bb65ba5d-4689-11e8-bee7-2d0da8da81ab', token_use: 'id', auth_time: 1524441800, iss: 'https://cognito-idp.us-west-2.amazonaws.com/us-west

aws-amplify-react Connect returns undefined data first

时光怂恿深爱的人放手 提交于 2019-12-13 14:58:50
问题 I have the following setup: aws-amplify-react appsync create-react-app and following this documentation: https://aws.github.io/aws-amplify/media/api_guide#connect As in the doc, rendering this gives me 2x undefined data before returning the correct data. This breaks the app, as nested fields (in my example, e.g. getRoom.id ) cannot be accessed. Component example: export const AppSyncTest = () => ( <Connect query={graphqlOperation(query)}> {({ data: { getRoom } }) => { console.log(getRoom); //

How to pass AWS AppSync custom request header in iOS client?

三世轮回 提交于 2019-12-13 04:58:09
问题 AWS AppSync supports passing custom headers from clients and accessing them in your GraphQL resolvers using $context.request.headers . I wonder how can I do that in iOS client ? Thanks :) https://docs.aws.amazon.com/appsync/latest/devguide/resolver-context-reference.html 回答1: I've just found a way to pass additional AWS AppSync Request Header in iOS Client :) Here is a sample class of AppSyncManager final class AppSyncManager { static func instance() -> AWSAppSyncClient { let tmpURL = URL

How to use filter in BatchGetItem

百般思念 提交于 2019-12-13 04:38:56
问题 I am fetching multiple items from dynamodb using BatchGetItem. But I need to filter items based on some conditions . For example: I have a task table having id and status. I need to fetch items of id 1, 2, 3 where status=done. #set($ids = [1,2,3]) { "operation" : "BatchGetItem", "tables" : { "userTable": { "keys": $util.toJson($ids) } } } 回答1: Filter expressions are not supported in BatchGetItem . Think of BatchGetItem as a batched version of the GetItem operation. GetItem only supports