aws-appsync

Running Lambda functions for server-side validation with AppSync and DynamoDB

﹥>﹥吖頭↗ 提交于 2019-12-07 12:10:55
问题 I've enjoyed working with AWS Amplify a lot lately, its code generation for GraphQL queries based on defined schema is outstanding. I came across one complication for defining custom logic / validation server-side. Out of the bag AppSync (part responsible for GraphQL api in Amplify) generates resolvers and DynamoDB tables for your schema. Resolvers are created using Apache Velocity templating language and if you are new to it, its a bit of a learning curve in my opinion. Furthermore, these

Reactjs/Apollo/AppSync Mutation triggered twice

落花浮王杯 提交于 2019-12-07 03:45:27
I'm having an issue with React/Apollo/AppSync with mutations triggering twice (or more). I have a React app that has an update mutation triggered by the usual UI button onClick. <button className={`btn btn-sm`} onClick={(event) => { that.toggleSubscription(event, subscriptionid, serviceid, status); }}> <i className={`fas ${icon} fa-fw`} /> {title} </button> The toggleSubscription function looks like this: toggleSubscription = async (event, subscriptionid, serviceid, currentStatus) => { event.preventDefault(); event.stopPropagation(); if (currentStatus === "mandatory") return; console.log

AppSync query resolver: are expressionNames and expressionValues necessary?

久未见 提交于 2019-12-06 16:38:04
https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html#aws-appsync-resolver-mapping-template-reference-dynamodb-query AppSync doc says that expressionNames and expressionValues are optional fields, but they are always populated by code generation. First question, should they be included as a best practice when working with DynamoDB? If so, why? AppSync resolver for a query on the partition key: { "version": "2017-02-28", "operation": "Query", "query": { "expression": "#partitionKey = :partitionKey", "expressionNames": { "#partitionKey":

Reactjs/Apollo/AppSync Mutation Optimistic Response Resolved ID

十年热恋 提交于 2019-12-06 16:21:14
问题 So first off I will start by saying I added an optimistic response to my mutation so it would it stop producing duplicates as referenced here and from this previous S.O. question. So that is all working but I have a set of dependant mutations that run after the first using async await. submitForm = async () => { // Only submit if form is complete if (!this.state.saveDisabled) { try { // Optimistic Response is necessary because of AWS AppSync // https://stackoverflow.com/a/48349020/2111538

GraphQL Query Runs Sucessfully One Time and Fails To Run Again using Apollo and AWS AppSync

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 15:51:54
I'm using the basic client configuration from the example on the first page of https://github.com/awslabs/aws-mobile-appsync-sdk-js repo: const client = new AWSAppSyncClient({ url: appSyncConfig.graphqlEndpoint, region: appSyncConfig.region, auth: { type: appSyncConfig.authenticationType, apiKey: appSyncConfig.apiKey, } }); But without the <Rehydrated> component, and with a Redux <Provider> component. The highest level parent component is wrapped like this: <Provider store={store}> <ApolloProvider client={client}> <App/> </ApolloProvider> </Provider> I've tried swapping the order for the

AppSync S3Object retrieval

与世无争的帅哥 提交于 2019-12-06 07:21:49
问题 My files are currently being uploaded to an s3 bucket according to the tutorials provided. I have a Post type with a file field pointing to an S3Object. S3Object has the values of bucket, key, and region. I want to allow my users to download their uploaded files, but I cannot access Post > file through a query. This means I cannot get the download URL. Right now, DynamoDB stores the following for file upon upload (I've changed the values here): {"s3":{"key":"id.pdf","bucket":"my-bucket",

React Native + AWS AppSync - maximum data storage

左心房为你撑大大i 提交于 2019-12-06 05:19:12
I’m building an offline application which needs to store around 30,000 records. Will AWS AppSync have any performance issues with a data set of this size? I’ve used redux w/ redux-persist in the past, which saves the store offline, then refetchs and places in memory when the app launches. This causes fairly huge memory issues, especially when querying the data. I’m wondering if AppSync has the ability to use Realm or SQLite for offline storage and querying. Thanks. 来源: https://stackoverflow.com/questions/52862441/react-native-aws-appsync-maximum-data-storage

Running Lambda functions for server-side validation with AppSync and DynamoDB

爱⌒轻易说出口 提交于 2019-12-06 03:40:29
I've enjoyed working with AWS Amplify a lot lately, its code generation for GraphQL queries based on defined schema is outstanding. I came across one complication for defining custom logic / validation server-side. Out of the bag AppSync (part responsible for GraphQL api in Amplify) generates resolvers and DynamoDB tables for your schema. Resolvers are created using Apache Velocity templating language and if you are new to it, its a bit of a learning curve in my opinion. Furthermore, these resolvers are auto generated by Amplify cli. I'm not sure if editing them makes sense either in AppSync

Reactjs/Apollo/AppSync Mutation Optimistic Response Resolved ID

爷,独闯天下 提交于 2019-12-04 21:00:32
So first off I will start by saying I added an optimistic response to my mutation so it would it stop producing duplicates as referenced here and from this previous S.O. question . So that is all working but I have a set of dependant mutations that run after the first using async await. submitForm = async () => { // Only submit if form is complete if (!this.state.saveDisabled) { try { // Optimistic Response is necessary because of AWS AppSync // https://stackoverflow.com/a/48349020/2111538 const createGuestData = await this.props.createGuest({ name: this.state.name, }) let guestId =

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

半腔热情 提交于 2019-12-04 16:02:36
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": "bar", "bazz": "buzz", } }) }; As you can see, it is pretty much straight forward. I just return an