Questions tagged with AWS AppSync

Content language: English

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

I'm currently building a Web application that stores data on DynamoDB. I need to perform some GraphQL queries that need auth users on the Cognito user pool. My application login users with the IAM auth but when I query some information, every response is null. I'm looking for a way to query information after login retrieving the Cognito user (already retrieved in my app) and passing it to the query function. Is this possible? All the GraphQL works correctly in the AppSync view tested with Cognito user pool auth and VTL resolvers. I would like to achieve the same result on the front end but it seems like I'm missing something
1
answers
1
votes
11
views
asked 4 days ago
Is it possible to use codeguru only for performing security scans/checks. Though codeguru provides other scans, I am interested in using codeguru only for security scans. Does AWS provide such facility?
2
answers
0
votes
15
views
asked 7 days ago
In Amazon OpenSearch Service i have a service running, if i go to the dashboard and click on discover, i have an index with data that i can search trough. Now i want the data displayed in my react app and also searchable. I tried many things but it does not work to connect to my opensearch service and get the data. How do i fix this?
1
answers
0
votes
21
views
robbe
asked 8 days ago
Hello, customer is building an app that uses Cognito User Pools federated with on-prem Central Authentication Service (CAS) via SAML. This provides JWT tokens. With this token they are calling GraphQL API from AppSync implemented via Amplify with DynamoDB. They are using "aws-amplify" library for this. There are no errors when the call is a query or mutations. For example: API.graphql(graphqlOperation(<some query here>, {}, <token>)).then( (res) => (....) But there is an exception if the call is of type "subscribe", example: API.graphql(graphqlOperation(<some subscription name here>, {}, <token>)).subscribe({ next: (data) => (....) message: "Connection failed: UnauthorizedException" I can provide more details or arrange a customer call if anyone is eager to help out with this issue.
0
answers
0
votes
23
views
AWS
asked 9 days ago
I am trying to create an AppSync API using the Blog App sample project. When I try to create it, the process fails. The error that I receive in the CloudFormation logs is: "Resource handler returned message: "Specified ReservedConcurrentExecutions for function decreases account's UnreservedConcurrentExecution below its minimum value of [10]. (Service: Lambda, Status Code: 400, Request ID:" I've checked my other Lambda functions, and I don't see any function that are using any reserved executions. Is there any way for me to get this to work?
1
answers
0
votes
19
views
therm81
asked 9 days ago
I'm trying to setup an authorization function for a specific request (here: topic subscription for push notifications). The function should be invoked anytime when someone calls the corresponding "function"/type. As far as I understand the following code should setup a type, that runs the authorization function: ``` type Mutation { subscribe(topic: String, subscription: String): String @aws_lambda(name: "isAuthorizedToSubscribe") } ``` The *request mapping template* looks as follows: ``` { "version" : "2018-05-29", "operation": "PutItem", "key" : { "topic": { "S" : "$ctx.args.topic" }, "subscription": $util.dynamodb.toDynamoDBJson($ctx.args.subscription) } } ``` Lambda function `isAuthorizedToSubscribe`: ``` exports.handler = (event, context, callback) => { console.log("*** Authorization handler for subscription was called ***") return {isAuth: false} } ``` Problem: <br> The lambda function does not get called and the request always goes through. Notes: - The lambda function `isAuthorizedToSubscribe` has the permission to be invoked by AppSync. - This question is only about authorization for a call. It's not about authentication (which should be done earlier in the process via other measures (API key, cognito, ...)) - I also tried adding `"authorizationFunction": "cbe-trial2-push-isAuthorizedToSubscribe",` into the mapping template, but that resulted in `Unsupported element '$[authorizationFunction]'.` upon request.
Accepted AnswerAWS AppSyncSecurity
1
answers
0
votes
30
views
Peter
asked 12 days ago
I'm trying to getUser with Id through Amplify.API My schema : ``` type User @model @searchable @auth(rules: [{ allow: owner,ownerField: "id", operations: [create, read, delete, update]}, { allow: public, operations: [read, update] }]){ id: ID! name:String! username: String! posts: [Post]!@hasMany notification: [Notification]!@hasMany searchHistory: [Search]!@hasMany } type Notification @model @auth(rules: [{ allow: owner,ownerField: "forUser", operations: [create, read, delete, update]},{ allow: public , operations: [create, read, delete, update]}]) { content: String! byUser: User forUser: User! @belongsTo } type Search @model @searchable @auth(rules: [{ allow: owner,ownerField: "user", operations: [create, read, delete, update]},{ allow: public , operations: [create, read, delete, update]}]) { id: ID! searchValue: String! user: User! @belongsTo } type Post @model @searchable @auth(rules: [{ allow: owner,ownerField: "byUser", operations: [create, read, delete, update]}, { allow: public, operations: [create, read, delete, update] }]){ id: ID! title: String! byUser: User! @belongsTo } ``` Error: ``` [{"locations":[{"column":9,"line":10}],"message":"Validation error of type SubSelectionRequired: Sub selection required for type null of field forUser @ \u0027getUser/notification/items/forUser\u0027"},{"locations":[{"column":9,"line":38}],"message":"Validation error of type SubSelectionRequired: Sub selection required for type null of field user @ \u0027getUser/searchHistory/items/user\u0027"}] ``` Look I'm getting this when I'm adding auth rules, but why I'm not getting for Post model, post has also ```byUser: User! @belongsTo``` as a owner? why I'm getting for only notification and search?
0
answers
0
votes
13
views
asked 14 days ago
Where has the option of configuring request and response mapping template gone when creating a resolver for your data source? The way it was done in VTL?
0
answers
0
votes
26
views
asked 18 days ago
I want to write some logic like fetch post with time limit 1 day(created date) and if the list of items are smaller then 20 then fetch the post within 2 days(created date). like: ``` const params = { TableName: 'Todo-xxxxxxxxxxxxxxx-dev', IndexName: 'title-createdAt-index', "Limit": 10, KeyConditionExpression: '#title =:value and #createdAt BETWEEN :start AND :end', ExpressionAttributeValues: { ':value': 'hi', ':start':'2023-06-29T03:47:35.343Z', ':end': '2023-06-30T03:47:35.343Z' }, ExpressionAttributeNames: { '#title': 'title', '#createdAt':'createdAt' } }; ``` if the above code returns 10 list items then I will fetch with time limit ':start':'2023-06-28T03:47:35.343Z', ':end': '2023-06-29T03:47:35.343Z' and if it returns 6 items then I will fetch items again 1 days ago. Is this a good practice?
1
answers
0
votes
26
views
asked 21 days ago
I just want to compare something like ```post tag ["bird","fruits","books"]``` with ```user interest ["cars","software","laptop","movies","books","coding"]``` look one element of each array is matching but I want to create a sort so that I can get the psots related to intrest.
0
answers
0
votes
20
views
asked 21 days ago
I created several custom mutations and queries as below and set their output to non-@model type. ``` type someOutput { a : Int b: String } type Mutation { someMutation( input: someInput! ): someOutput @function(name: "lambdafunction-${env}") @auth(rules: [{ allow: private }]) } ``` When I test this in AppSync, a "Not Authorized to access on type" error occurs. I couldn't solve it by setting globalAuthRule to public. It can be solved by granting field-level authorization to all fields. Is there any way to grant permission to non-@model type without using field level authorization? Or should I write the schema some other way? I am very confused because I have used schema written in the same way in other projects and used it well.
1
answers
0
votes
17
views
gerrard
asked 21 days ago
I want to use Amplify Datastore only for caching the data, kind of fetching data through API and storing them in Datastore for a short period. I don't want any sync.
0
answers
0
votes
10
views
asked 21 days ago