Network Error when the app calls API.graphQL
See original GitHub issueWhen the app is calling api.graphQL after login, I get a network error (More info shown below)
Here is the code i used to test it:
`const [system, setSystem] = useState({}); console.log(“testing”);
useEffect(() => { //https://dev.to/rmuhlfeldner/how-to-use-an-aws-amplify-graphql-api-with-a-react-typescript-frontend-2g79 checkAuthState();
async function getData() {
console.log("get Data");
try {
const QueryData = await API.graphql({query:getQuerySystem,variables:{id:"Lambert"}});
console.log("test 2");
setSystem(QueryData);
console.log(system.Temp);
} catch (error) {
console.error("Error fetching todos", error);
}
}
getData();
}, []); async function checkAuthState() { try { await Auth.currentAuthenticatedUser(); console.log(‘✅ User is signed in’); } catch (err) { console.log(‘❌ User is not signed in’); console.error(err); } }`
checkAuthState() function returns :
✅ User is signed in
Screenshot of the error message on the app
If any more info is needed feel free to ask below. Thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Handling operation errors - Apollo GraphQL Docs
When a network error occurs, Apollo Client adds it to the error.networkError field returned by your useQuery call (or whichever operation hook you...
Read more >Network Error when initiating a query to my graphql API
Here's my client request : const client = new ApolloClient({ uri: 'https://my-app.herokuapp.com/', headers: { authorization: "Bearer API_KEY ...
Read more >Resolve unauth errors for GraphQL requests in AWS AppSync
For a 401 Unauthorized response, check the network request that sends the GraphQL payload to confirm that: The Authorization or x-api-key header ...
Read more >Top GraphQL Errors and How to fix them
All the errors above come under the category of GraphQL errors with a response status code of 200 . When there is a...
Read more >GraphQL Content API - Contentful
The GraphQL Content API responses via GitHub contains errors that occur during the different phases of a request (authentication, validation, schema generation ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Are you running the API locally with a mock by chance? If so, is the address
http
instead ofhttps
? The Android emulator or physical devices connected via USB can sometimes have issues connecting to a local url.This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels or Discussions for those types of questions.