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

#1

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!

#2

This is not an Expo-related issue. It has to do with Apollo. For more information: https://github.com/apollographql/react-apollo/issues/891

#3

Glad you figured it out!

1 Like
#4

I have the same problem but I do not use Apollo

#5

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.

#6

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