I'm using AWS Amplify, React Native, and Expo to make an app. My DynamoDB tables are set up via a schema.graphql file, and I've generated a bunch of mutations in a mutations.js file. I want to call the following mutations.js mutation from my HomeScreen.js screen file:
export const createConversation = `mutation CreateConversation(
$input: CreateConversationInput!
$condition: ModelConversationConditionInput
) {
createConversation(input: $input, condition: $condition) {
id
centralStatement {
id
description
evidence {
id
description
source
userScores
}
source
userScores
}
participants {
id
username
conversations {
id
}
}
}
}
`;
Then I call this mutation in HomeScreen.js via a "Start a conversation" button:
import { API, graphqlOperation } from 'aws-amplify'
import { createConversation } from '../src/graphql/mutations'
export default function HomeScreen() {
let handleConvoStartPress = async () => {
let convoData = {
id: 'blah',
centralStatement: {
id: 'blah',
description: 'blah',
evidence: {
id: 'blah',
description: 'blah',
source: 'blah',
userScores: 'blah',
},
source: 'blah',
userScores: 'blah',
},
participants: {
id: 'blah',
username: 'blah',
conversations: {
id: 'blah',
},
},
};
let newConvo = await API.graphql(graphqlOperation(createConversation, {input: convoData}))
console.log('*** Success ***');
console.log(newConvo);
}
return (
<View>
<ScrollView>
<View>
<TouchableOpacity onPress={handleConvoStartPress}>
<Text>
Start a conversation
</Text>
</TouchableOpacity>
</View>
</ScrollView>
</View>
);
}
But when I press "Start a conversation" I get this error:
Possible Unhandled Promise Rejection (id: 0):
Object {
"data": Object {},
"errors": Array [
[GraphQLError: Request failed with status code 403],
],
}
-which I think (from this) means I need to add a X.509 certificate or AWS access key ID. How do I do that? I'm struggling to find the right instructions/examples.