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.

When internet connection is lost: TypeError: handler is not a function.

See original GitHub issue

I’ve tested this on a real iOS device. I’m using Expo SDK 37

Environment

System: OS: macOS 10.15.4 CPU: (16) x64 Intel® Core™ i9-9880H CPU @ 2.30GHz Memory: 3.01 GB / 32.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 13.2.0 - ~/.nvm/versions/node/v13.2.0/bin/node Yarn: 1.19.2 - /usr/local/bin/yarn npm: 6.14.4 - ~/.nvm/versions/node/v13.2.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 IDEs: Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: https://github.com/expo/react-native/archive/sdk-37.0.0.tar.gz => 0.61.4 npmGlobalPackages: react-native-cli: 2.0.1

Platforms

iOS on Expo SDK 37.

Versions

Description

If I turn off wifi or cellular data, this error appears: image Even before I turn of the wifi, I get this error:

[Unhandled promise rejection: TypeError: handler is not a function]
- node_modules/@react-native-community/netinfo/src/internal/state.ts:65:9 in State#_handleInternetReachabilityUpdate
* <anonymous>:null in Set.forEach
* http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:154509:28 in InternetReachability.State._handleInternetReachabilityUpdate [as _listener]
* http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false:154672:13 in InternetReachability._setIsInternetReachable
- node_modules/@react-native-community/netinfo/src/internal/internetReachability.ts:119:19 in Promise.race.then.then._catch$argument_0
- node_modules/promise/setimmediate/core.js:37:11 in tryCallOne

Reproducible Demo

I’m not sure how to make a reproducible error - this is a legacy project that I’m trying to fix. But if I go to this file and erase line 65, the yellow warning message goes away - but obviously doesn’t fix the issue (node_modules/@react-native-community/netinfo/src/internal/state.ts:65:9)

This is my package.json:

{
  "main": "node_modules/expo/AppEntry.js",
  "private": true,
  "dependencies": {
    "@expo/vector-icons": "^10.0.0",
    "@mapbox/polyline": "^0.2.0",
    "@react-native-community/art": "react-native-community/art",
    "@react-native-community/masked-view": "0.1.6",
    "@react-native-community/netinfo": "5.5.1",
    "@redux-offline/redux-offline": "git+https://github.com/alanjudson/redux-offline.git",
    "@shoutem/ui": "^2.0.3",
    "eon-map": "^1.2.2",
    "eslint": "^4.19.1",
    "ex-react-native-i18n": "0.0.3",
    "expo": "^37.0.7",
    "expo-asset": "~8.1.4",
    "expo-camera": "~8.2.0",
    "expo-cli": "^3.18.2",
    "expo-constants": "~9.0.0",
    "expo-file-system": "~8.1.0",
    "expo-font": "~8.1.0",
    "expo-image-manipulator": "~8.1.0",
    "expo-location": "~8.1.0",
    "expo-media-library": "~8.1.0",
    "expo-permissions": "^8.1.0",
    "expo-web-browser": "~8.1.0",
    "geolib": "^2.0.24",
    "moment": "^2.21.0",
    "native-base": "^2.13.12",
    "prop-types": "^15.6.0",
    "pubnub": "^4.20.2",
    "pubnub-react": "^1.2.0",
    "react": "16.9.0",
    "react-devtools": "^4.6.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-37.0.0.tar.gz",
    "react-native-app-link": "^0.4.1",
    "react-native-aws3": "0.0.8",
    "react-native-calendars": "^1.16.1",
    "react-native-gesture-handler": "^1.6.1",
    "react-native-i18n": "^2.0.10",
    "react-native-image-resizer": "^1.0.0",
    "react-native-indicators": "^0.17.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-linear-gradient": "~2.5.6",
    "react-native-lock": "^0.6.1",
    "react-native-maps": "0.26.1",
    "react-native-maps-directions": "^1.4.1",
    "react-native-modal": "^11.5.6",
    "react-native-phone-call": "^1.0.9",
    "react-native-photo-view": "github:shoutem/react-native-photo-view#0ffa1481f6b6cb8663cb291b7db1d6644440584d",
    "react-native-reanimated": "~1.7.0",
    "react-native-responsive-dimensions": "^1.0.2",
    "react-native-safe-area-context": "^0.7.3",
    "react-native-screens": "~2.2.0",
    "react-native-tab-view": "0.0.74",
    "react-native-vector-icons": "^6.6.0",
    "react-native-webview": "^7.5.0",
    "react-navigation": "^4.3.8",
    "react-navigation-stack": "^2.3.13",
    "react-redux": "^5.0.6",
    "redux": "^3.7.2",
    "redux-persist": "^5.10.0",
    "redux-saga": "^0.16.0",
    "webpack": "^4.28.4"
  },
  "devDependencies": {
    "eslint-config-airbnb": "^16.1.0",
    "eslint-plugin-import": "^2.8.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-react": "^7.5.1",
    "react-native-debugger-open": "^0.3.15",
    "schedule": "^0.4.0"
  },
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject"
  }
}

If there’s anything more I can provide, please let me know. First time posting an issue, ever.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

6reactions
kidawwcommented, May 4, 2020

image

Now i fixed it like that. No one listener string type now at first aurgument

0reactions
Creativemastcommented, Nov 15, 2022

image

Now i fixed it like that. No one listener string type now at first aurgument

where to add this functions

Read more comments on GitHub >

github_iconTop Results From Across the Web

When internet connection is lost: TypeError: handler is not a ...
I've tested this on a real iOS device. I'm using Expo SDK 37 Environment System: OS: macOS 10.15.4 CPU: (16) x64 Intel(R) Core(TM)...
Read more >
TypeError: handler is not a function using Firebase and ...
I registered my function as a standard https-function with onRequest and tried calling it as a callable function.
Read more >
Handling errors - Node-RED
Not all errors conditions will appear as error events that can be caught be a Catch node. For example, the MQTT nodes losing...
Read more >
Meta programming - JavaScript - MDN Web Docs
Here, an object that is proxied will not return undefined when ... If you violate the invariants of a handler, a TypeError will...
Read more >
Handling operation errors - Apollo GraphQL Docs
Error types. Executing GraphQL operations on a remote server can result in GraphQL errors or network errors. GraphQL errors. These are errors related...
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