question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

can't find variable self when using apollo 2.0 with react-native

See original GitHub issue

I tried to upgrade apollo inside a react native project from 1.x to 2.0 but i ran into a redbox error.

Intended outcome: The app should normally render

Actual outcome: The app breaks with a redbox which says: "cant find variable self" in fetch-npm-browserify.js

screen shot 2017-11-10 at 17 26 07

How to reproduce the issue: install apollo 2.0 in a react-native project

Version

{
 "apollo-cache-inmemory": "1.0.0",
 "apollo-client": "2.0.1",
 "apollo-link-batch-http": "^1.0.0",
 "apollo-link-error": "^1.0.0",
 "apollo-link-http": "^1.1.0",
 "react-apollo": "^1.4.16",
}

thanks guys for your awesome work!!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
peggyrayziscommented, Nov 16, 2017

Hi @n1ru4l! We would love if you could send a PR to upgrade apollo-link-batch-http to use global fetch & give the user the ability to pass in a fetcher if they would prefer. You can look at the apollo-link-http source code for an example.

0reactions
hwillsoncommented, Jun 1, 2018

apollo-link-batch-http no longer uses apollo-fetch, so this issue should now be resolved. Please post back if you notice otherwise. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Error - Can't find variable: self - Stack Overflow
Here I have attached a screenshot. The error is thrown from the file, located at node_modules > isomorphic-fetch > fetch-npm-browserify.
Read more >
Queries - Apollo GraphQL Docs
This article shows how to fetch GraphQL data in React with the useQuery hook and attach ... If you avoid passing a variables...
Read more >
React Native and Apollo: Can't find variable - appsloveworld
Coding example for the question React Native and Apollo: Can't find variable: document-React Native.
Read more >
Build a GraphQL + React app with TypeScript - LogRocket Blog
Build a fully functioning React app using the SpaceX GraphQL API with TypeScript. This tutorial will walk you through each step.
Read more >
GraphQL Code Libraries, Tools and Services
A simple and flexible JavaScript GraphQL client that works in all JavaScript environments (the browser, Node.js, and React Native) - basically a lightweight ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found