V43.0.0 Expo App using Tunnel: "Can't find variable: self"

Hey everyone!

When I’m using --localhost or --tunnel in Simulator, no issues.

When I try to use the QR code + app on my phone, I get Can't find variable: self coming from fetch-npm-browserify.js:6:22

Any help would be appreciated, thanks!

This is not an Expo-related issue. It has to do with Apollo. For more information: react-native "Can't find variable: self" pointing to apollo-fetch and fetch-npm-browserfiy · Issue #891 · apollographql/react-apollo · GitHub

Glad you figured it out!

1 Like

I have the same problem but I do not use Apollo

without seeing the whole source code of your project, its hard to guess at what’s going wrong here. post it if you have it and feel comfortable. link to github / snack / etc.

i solved modifying fetch-npm-browserify.js file

I added these lines

// Return that as the export for use in Webpack, Browserify etc.
require(‘whatwg-fetch’);
//module.exports = self.fetch.bind(self);
var globalObject = typeof self === “undefined” ? global : self;
module.exports = globalObject.fetch.bind(globalObject);

1 Like