Hi,
I run a GraphQL mutation using the AWS AppSync Queries page. Now, the first time I try this mutation, everything works fine and the first time, but if I try to submit the mutation again without changing anything, I get an error...
This is my mutation:
mutation {
createStore(
input: {
storeName: "SomeStoreNYC",
geoLocation: {
latitude: 0.73,
longitude: 0.45
},
address: {
city: "New York",
country: "USA",
state: "NY",
address: "555 W 55th Street",
zipcode: "10010"
},
logoUrl: {
key: "logo-key",
bucket: "logo-bucket",
region: "usa-1"
},
phoneNumber: "999-999-3333"
}
){
id
}
}
This is the error that I get if I try the mutation above two times:
{
"data": {
"createStore": null
},
"errors": [
{
"path": [
"createStore"
],
"data": {
"id": "2c03a100-f992-4f20-a6db-799d98dc3d6c"
},
"errorType": "DynamoDB:ConditionalCheckFailedException",
"errorInfo": null,
"locations": [
{
"line": 2,
"column": 5,
"sourceName": null
}
],
"message": "The conditional request failed (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ConditionalCheckFailedException; Request ID: A4NNQQ0SR2U23FSHO0EK7AM5BJVV4KQNSO5AEMVJF66Q9ASUAAJG)"
}
]
}
Any suggestions??
Thanks
amplify add api
CLI as an annotated schema. Everything setup in the backend. But, it doesn't look like auth is correct. The run schema is disabled after I login.
type Todo @model {
id: ID!
name: String!
description: String
}
and
type Todo @model @key(fields:["id"]){
id: ID!
name: String!
description: String
}
generate distinct listTodo
, createTodo
and deleteTodo
operations. That doesn't make any sense to me, they should be the same, right?
@key
directive doesn't have a name, then it specifies the primary key of the underlying table.id
, and the underlying dynamodb table Todo
is the same, but the graphql schema and resolvers that are generated by Amplify are different, which drives my spider-sense crazy
id
, or, if you omit an id
, the createTodo
resolver that amplify generates will put a uuid into the id
field of the created Todo, so I'm not sure what you mean by "replace the ID that was generated for the records with one that I set"
type Upload
@model
@auth(
rules: [
{
allow: owner
queries: [get, list]
mutations: [create, update, delete]
}
{
allow: groups
groups: ["Director"]
queries: null
mutations: [create, update, delete]
}
{
allow: groups
groups: ["Audience"]
queries: [get, list]
mutations: null
}
]
)
@key(
fields: [
"guid"
]
)
{
id: ID!
status: String!
guid: String!
region: String!
upload_bucket: String
upload_key: String
}
if you have
type Todo @model {
id: ID!
status: String!
region: String!
upload_bucket: String
upload_key: String
}
then the following creation graphql operation gets generated by amplify:
input CreateTodoInput {
id: ID
status: String!
region: String!
upload_bucket: String
upload_key: String
}
type Mutation {
createTodo(input: CreateTodoInput!, condition: ModelTodoConditionInput): Todo
}
which is what you want, you can specify the id
when you create the Todo, or if you leave it out, amplify will create one for you
exports.handler = (event, context) => {
console.log(`EVENT ON BACK_END HANDLER FUNC: ${JSON.stringify(event)}`);
awsServerlessExpress.proxy(server, event, context);
};
Hello Everyone
I am currently working on a serverless backend using AWS Lambda and API Gateway. On the frontend side there are two developers, iOS and Android. I decided to use Cognito for our Auth and I am trying to provide the app developers with the correct documentation for them to follow. Also, I am trying to have minimum friction between the app developers and the backend.
Anyways, when I visit the AWS Mobile SDK Documentation page https://docs.aws.amazon.com/mobile-sdk/ , both the SDKs for iOS and Android redirect me to the AWS Amplify framework's website. I have previously used Amplify for a web based app and loved it. However, when I visit the iOS and Android "getting started" pages I find a note saying that Amplify iOS and Android are "in preview mode and not intended for production usage at this time". That said, When I went to the "Android/iOS SDK 2.0" pages I realised that one of the prerequisites is "installing and configuring Amplify CLI" .
My questions are:
I would also appreciate if anyone could share a production-supported step-by-step tutorial for integrating iOS/Android with Cognito?
Thanks
@Tee88
I would also appreciate if anyone could share a production-supported step-by-step tutorial for integrating iOS/Android with Cognito?
https://github.com/awslabs/aws-sdk-ios-samples
https://github.com/awslabs/aws-sdk-android-samples
This is how I'm calling it
const user = {
name: 'test',
email: 'test@test.com'
};
await Auth.federatedSignIn('okta', { token: token, expires_in: expires_in }, user);
where okta
is the name of the provider that is in the token.
token
is the idtoken
from okta
I'm working with Amplify Auth lambda triggers, and looking at the documentation
Errors thrown by Lambda triggers will be visible directly to your end users if they are using Amazon Cognito Hosted UI as query parameters in the Callback URL. As a recommended best practice, end user facing errors should be thrown from the Lambda triggers and any sensitive or debugging information should be logged in the Lambda trigger itself.
I don't understand what that means. I'm looking at the example files, and they all do different things, some console.warn
, some callback("error text");
, some callback(new Error("error text", event);
Can someone explain in simpler language what an end user facing error is?