Questions tagged [aws-appsync-resolver]

69 questions
0
votes
0 answers

How to use query operation with app sync auto generated resolver?

Below is the autogenerated resolver of appsync with DynamoDB. I am unable to understand what object I have to pass to use the Query operation. #set( $limit = $util.defaultIfNull($context.args.limit, 100) ) #set( $ListRequest = { "version":…
0
votes
1 answer

AppSync/GraphQL filter nested objects

I have a DynamoDB table with the following structure site (String) addresses (List) |-> address (String) |-> isCurrent (Boolean) I want to filter a specific site for either current or all address(s). query MyQuery { …
0
votes
0 answers

Authorize based on field value in another document in AppSync GraphQL custom authentication via Lambda Resolver

I am new to Amplify Datastore & AppSync w/ GraphQL, but in Firestore, you can write an auth rule like: allow delete: if request.auth != null && get(/databases/$(database)/documents/users/$(request.auth.uid)).data.admin == true…
0
votes
2 answers

AWS::AppSync::Resolver using javascript in CloudFormation .yml fails to build

I'm having problems creating an AWS::AppSync::Resolver that is a PIPELINE kind, written in JavaScript. I think that the problem lies in what i write for Code: since in AWS docs it is not explained to details it only says that it is of type String.…
0
votes
0 answers

Can a single VTL resolver be attached to pipeline in a way to be executed before/after ANY of the AppSync's GraphQL request?

Developer can add VTL resolver to be executed before/after specific graphQL requests. Question is, is there a way to "slot" (attach) VTL resolver that would be executed with any graphQL request, not just specific one? Currently, I place…
0
votes
1 answer

AppSync pipeline resolver for appending data to each item within a list

How can I create a resolver that adds data from another DocumentDB collection to each item within the query response list? Given the grossly overly simplified following schema: type Asset { id: ID! ... } type DeviceData { id: ID! assetID:…
studiobrain
  • 1,135
  • 2
  • 13
  • 35
0
votes
0 answers

How to create objects(like in JS) in AWS appsync resolvers?

I am trying to create this scenario in my resolvers file: let { data } = await context.client.post( `https://myendpoint.com/api?action=getUserApiKey&user=${user}&password=${password}&2faCode=${secondFactorToken}`, ); var userData = { …
Dreamer
  • 112
  • 1
  • 14
0
votes
0 answers

How to read GraphQL enum values in AppSync resolver template?

I have an enum in my schema in the following way: type Item { name: String! } enum ItemType { Simple Advanced } input ValueSimple { simple: Int } input ValueAdvanced { advanced: Int } input InputItemSchedule { type: ItemType! …
Gasim
  • 7,615
  • 14
  • 64
  • 131
0
votes
0 answers

AWS AppSync: How to query the database inside resolver?

I am use AWS AppSync and AWS Amplify I have 2 models: type Post { id: ID! title: String! description: String createdAt: String } type User { id: ID! username: String! age: Int! } I create a custom req.vtl file like that: ##…
jonathan
  • 105
  • 7
0
votes
2 answers

Floats rounded down in AWS AppSync VTL

I am creating a resolvers response mapping in AWS AppSync which is meant to perform a math calculation and return a percentage value as a float: #set( $result = $ctx.source.total * 100 / 365000 ) $result However VTL rounds this down each time to…
leepowell
  • 3,838
  • 8
  • 27
  • 35
0
votes
0 answers

How to code a simple algorithm to fetch list of data through pagination in a fresh new application?

I'm making a clone of social app. I'm using graphQL as my backend. My problem is that every time I query a list of data it is returning the same result. When I will release that app, the user base will be very small so the amount or data is less in…
0
votes
1 answer

Does the auto generated query to list a type by Appsync always do a full table scan?

I have this type that I've defined below. And appsync will build out the query to retrieve a list. When I look in dynamodb the id is the primary key. So is it me or is this extremely inefficient as it would have to scan the entire table to find all…
stack
  • 613
  • 10
  • 20
0
votes
2 answers

How can I filter a subscription using a custom resolver

I am working on a messaging app using AWS AppSync. I have the following message type... type Message @model @auth( rules: [ { allow: groups, groups: ["externalUser"], operations: [] } ] ) { id: ID! …
Bob
  • 45
  • 1
  • 5
0
votes
0 answers

AppSync Query displays null values

I am using a lambda as a resolver for a GraphQL Query from AppSync. When I run the Query from AppSync Console, the lambda works fine and returns the requested data, but on the AppSync console, the results show null values on the defined query…
0
votes
1 answer

Empty data in AWS AppSync GraphQL subscription event

I have an application that uses a GraphQL API, provided by the AWS AppSync service. It uses GraphQL subscriptions to send messages between different clients in near real time. There is a mutation pushItems that's configured with a resolver, which…
Jonathan Holvey
  • 697
  • 9
  • 27