Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled error Network error: Network request failed Error: #15121

Closed
haris-ramzan opened this issue Jul 20, 2017 · 2 comments
Closed

Unhandled error Network error: Network request failed Error: #15121

haris-ramzan opened this issue Jul 20, 2017 · 2 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@haris-ramzan
Copy link

I got this error in my application ( react-native ) when internet connection is lost.

Version

"apollo-client" "1.0.4",
"react-apollo": "1.1.1",
"react-native": "0.44.0",

Found this error on console

"ExceptionsManager.js:71 Unhandled error Network error: Network request failed Error: Network error: Network request failed at new ApolloError"

How can i fix this issue: Here is my Screen-Shot,
screenshot_1499843569

import { AsyncStorage } from 'react-native';
import {SubscriptionClient, addGraphQLSubscriptions} from 'subscriptions-transport-ws';

const wsClient = new SubscriptionClient('wss://172.20.32.6:5000', {
  reconnect: true,
  connectionParams: {
    accessToken: 'jka sdhkjashd jkashdjk ashdas'
  }
});

const networkInterface = createNetworkInterface({

  uri: 'http://172.20.32.6:8000/graphql',
  opts: {
    credentials: 'same-origin'
  }
});
const networkInterfaceWithSubscriptions = addGraphQLSubscriptions(
  networkInterface,
  wsClient
);
const client = new ApolloClient({
  dataIdFromObject: o => o.id,
  networkInterface: networkInterfaceWithSubscriptions

});
networkInterface.use([{
  applyMiddleware(req, next) {
    if (!req.options.headers) {
      req.options.headers = {};  // Create the header object if needed.
    }
    // get the authentication token from local storage if it exists
    AsyncStorage.getItem('sessionToken').then((token) => {
      req.options.headers.Authorization = token ? `${token}` : null;
      next();
    }
    );
  }
}]);
export default client; 


@hramos
Copy link
Contributor

hramos commented Jul 20, 2017

This issue looks like a question that would be best asked on StackOverflow.

StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only.

Will close this as this is really a question that should be asked on StackOverflow.

@hramos hramos closed this as completed Jul 20, 2017
@reactionic27
Copy link

reactionic27 commented Mar 5, 2018

@haris-ramzan
did you fixed this error at all?
I am getting same error also

@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants