I'm having trouble with using he graphQL from AWS.
I can successfully login and confirm the user with Cognito as I can see it in the console.
Sign in with Cognito:
async signIn(email, password) {
try {
//sign in the user
const user = await Auth.signIn(email, password);
AlertHelper.show('info', 'yups', user);
}
//If not a user then display message
catch (error) {
AlertHelper.show("warn", "User not found", "Please create an account");
}
}
Returns a successful message then I call another function to call the graphQL api:
async check() {
try {
const userInfo = await Auth.currentAuthenticatedUser({bypassCache:true})
console.log("User info: ",userInfo)
//If there is a user
if(userInfo){
const userData = await API.graphql(graphqlOperation(getUser));
console.log("User Data: ",userData);
}
}
catch (err) {
console.log('Error: ', err)
}
}
Here is the error even though the user info is correct:
errors: [ [GraphQLError: No graphql endpoint provided.] ] }
Here is my AWS Exports:
const awsmobile = {
"aws_project_region": "eu-west-1",
"aws_cognito_identity_pool_id": "eu-west-1:xxxxxxxxxxxxxxxxxxxxxx",
"aws_cognito_region": "eu-west-1",
"aws_user_pools_id": "eu-west-1_xxxxxxxxx",
"aws_user_pools_web_client_id": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
"oauth": {}
};
export default awsmobile;
Get User:
export const getUser = /* GraphQL */ `
query GetUser($id: ID!) {
getUser(id: $id) {
id
name
coins
description
createdAt
updatedAt
}
}
`;
Im tearing my hair out here please help!!
question from:
https://stackoverflow.com/questions/66045793/no-graphql-endpoint-provided 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…