Expo SDK39 -> SDK40 upgrade TypeError: undefined is not an object (evaluating 'inspect.custom')

Please provide the following:

  1. SDK Version: SDK40
  2. Platforms(Android/iOS/web/all): Android
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

upgraded Expo SDK along with referring to the “Deprecations, renamings, and removals” section of the SDK 40 upgrading post from SDK39 to SDK40 and got an error.

expo diagnostics

  Expo CLI 4.0.17 environment info:
    System:
      OS: macOS 11.1
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.5.0 - /usr/local/bin/node
      Yarn: 1.22.10 - /usr/local/bin/yarn
      npm: 6.14.11 - /usr/local/bin/npm
    Managers:
      CocoaPods: 1.9.3 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: iOS 14.3, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    IDEs:
      Android Studio: 4.0 AI-193.6911.18.40.6514223
      Xcode: 12.3/12C33 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^40.0.0 => 40.0.1 
      react: 16.13.1 => 16.13.1 
      react-dom: 16.13.1 => 16.13.1 
      react-native: https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz => 0.63.2 
      react-native-web: ~0.13.12 => 0.13.18 
      react-navigation: ^4.4.3 => 4.4.3 
    npmGlobalPackages:
      expo-cli: 4.0.17
    Expo Workflow: managed

package.json

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@expo/react-native-action-sheet": "^3.8.0",
    "@expo/vector-icons": "^12.0.0",
    "@react-native-community/async-storage": "~1.12.0",
    "@react-native-community/checkbox": "^0.5.5",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "5.9.7",
    "@react-native-community/picker": "1.6.6",
    "@react-native-community/viewpager": "4.2.0",
    "@react-navigation/bottom-tabs": "^5.10.2",
    "@react-navigation/drawer": "^5.10.2",
    "@react-navigation/material-top-tabs": "5.2.16",
    "@react-navigation/native": "^5.8.2",
    "@react-navigation/stack": "^5.11.1",
    "axios": "^0.20.0",
    "debounce": "^1.2.0",
    "expo": "^40.0.0",
    "expo-app-loading": "^1.0.1",
    "expo-asset": "~8.2.1",
    "expo-av": "~8.7.0",
    "expo-background-fetch": "~8.6.0",
    "expo-barcode-scanner": "~9.1.0",
    "expo-blur": "~8.2.2",
    "expo-brightness": "~8.4.0",
    "expo-camera": "~9.1.0",
    "expo-contacts": "~8.6.0",
    "expo-device": "~2.4.0",
    "expo-file-system": "~9.3.0",
    "expo-font": "~8.4.0",
    "expo-linear-gradient": "~8.4.0",
    "expo-location": "~10.0.0",
    "expo-media-library": "~10.0.0",
    "expo-network": "~2.4.0",
    "expo-notifications": "~0.8.2",
    "expo-permissions": "~10.0.0",
    "expo-screen-capture": "^1.1.1",
    "expo-sms": "~8.4.0",
    "expo-splash-screen": "~0.8.1",
    "expo-sqlite": "~8.5.0",
    "expo-status-bar": "~1.0.3",
    "expo-task-manager": "~8.6.0",
    "expo-updates": "~0.4.1",
    "expo-video-player": "^1.6.1",
    "expo-video-thumbnails": "~4.4.0",
    "expo-web-browser": "~8.6.0",
    "fiction-expo-restart": "^1.0.5",
    "formik": "^2.2.1",
    "jsbarcode": "^3.11.3",
    "lodash": "^4.17.20",
    "lottie-ios": "3.1.8",
    "lottie-react-native": "~2.6.1",
    "moment": "^2.29.1",
    "prop-types": "^15.7.2",
    "query-string": "^6.13.6",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
    "react-native-animatable": "^1.3.3",
    "react-native-appearance": "~0.3.3",
    "react-native-auto-height-image": "^3.2.3",
    "react-native-autoheight-webview": "^1.5.4",
    "react-native-elements": "^2.3.2",
    "react-native-expo-image-cache": "^4.1.0",
    "react-native-extended-stylesheet": "^0.12.0",
    "react-native-gesture-handler": "~1.8.0",
    "react-native-image-gallery": "^2.1.5",
    "react-native-image-slider": "^2.0.3",
    "react-native-image-zoom-viewer": "^3.0.1",
    "react-native-modal": "^11.5.6",
    "react-native-qrcode-svg": "^6.0.6",
    "react-native-reanimated": "~1.13.0",
    "react-native-safe-area-context": "3.1.9",
    "react-native-screens": "~2.15.2",
    "react-native-scrollable-tab-view": "^1.0.0",
    "react-native-svg": "12.1.0",
    "react-native-tab-view": "2.15.1",
    "react-native-vector-icons": "^7.1.0",
    "react-native-web": "~0.13.12",
    "react-native-webview": "11.0.0",
    "react-navigation": "^4.4.3",
    "react-navigation-drawer": "^2.6.0",
    "react-navigation-header-buttons": "5.0.2",
    "react-redux": "^7.2.2",
    "react-refresh": "^0.9.0",
    "redux": "^4.0.5",
    "redux-thunk": "^2.3.0",
    "styled-components": "^5.2.1",
    "urijs": "^1.19.2"
  },
  "devDependencies": {
    "@babel/core": "^7.12.10",
    "@babel/plugin-syntax-class-properties": "^7.12.1",
    "@babel/runtime": "^7.12.1",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.1",
    "babel-plugin-module-resolver": "^4.0.0",
    "babel-preset-expo": "8.3.0",
    "jest": "^26.6.1",
    "metro-react-native-babel-preset": "^0.60.0"
  },
  "private": true,
  "jest": {
    "preset": "react-native"
  }
}

Error

TypeError: undefined is not an object (evaluating 'inspect.custom')
- node_modules/react-native/Libraries/LogBox/LogBox.js:148:8 in registerError
- node_modules/react-native/Libraries/LogBox/LogBox.js:59:8 in errorImpl
- node_modules/react-native/Libraries/LogBox/LogBox.js:33:4 in console.error
- node_modules/expo/build/environment/react-native-logs.fx.js:27:4 in error
- node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
- node_modules/react-native/Libraries/Core/ExceptionsManager.js:171:19 in handleException
- node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
- node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:9:32 in ErrorUtils.setGlobalHandler$argument_0
- node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
- node_modules/regenerator-runtime/runtime.js:293:29 in invoke
- node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
- node_modules/regenerator-runtime/runtime.js:154:27 in invoke
- node_modules/regenerator-runtime/runtime.js:164:18 in PromiseImpl.resolve.then$argument_0
- node_modules/react-native/node_modules/promise/setimmediate/core.js:37:13 in tryCallOne
- node_modules/react-native/node_modules/promise/setimmediate/core.js:123:24 in setImmediate$argument_0
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:130:14 in _callTimer
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:181:14 in _callImmediatesPass
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:441:30 in callImmediates
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:387:6 in __callImmediates
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:135:6 in __guard$argument_0
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:364:10 in __guard
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:134:4 in flushedQueue
* [native code]:null in flushedQueue
* [native code]:null in invokeCallbackAndReturnFlushedQueue

I’ve been trying to fix it for three days still can’t solve it.
when I checked the code line by line I found a cause by import * as Notifications from 'expo-notifications’

Hopefully, someone can help me, any help is appreciated. Thank you very much!

hi! try following this guide i just wrote up to help narrow down the source of the problem and let me know what you find debugging.md · GitHub

in this case, it seems like you got far enough to where you have identified a line of code that is causing the problem, but the next step is to try it in a new project. i went ahead and did this, and it works as expected. so, now you can try to circle back to your project find out what the difference is

I found this

Error: Requiring module "node_modules/expo-notifications/build/index.js", which threw an exception: TypeError: undefined is not an object (evaluating 'inspect.custom')
- node_modules/react-native/Libraries/LogBox/LogBox.js:148:8 in registerError
- node_modules/react-native/Libraries/LogBox/LogBox.js:59:8 in errorImpl
- node_modules/react-native/Libraries/LogBox/LogBox.js:33:4 in console.error
- node_modules/expo/build/environment/react-native-logs.fx.js:27:4 in error
- node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
- node_modules/react-native/Libraries/Core/ExceptionsManager.js:171:19 in handleException
- node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
- node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:9:32 in ErrorUtils.setGlobalHandler$argument_0
- node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
- node_modules/regenerator-runtime/runtime.js:293:29 in invoke
- node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
- node_modules/regenerator-runtime/runtime.js:154:27 in invoke
- node_modules/regenerator-runtime/runtime.js:164:18 in PromiseImpl.resolve.then$argument_0
- node_modules/react-native/node_modules/promise/setimmediate/core.js:37:13 in tryCallOne
- node_modules/react-native/node_modules/promise/setimmediate/core.js:123:24 in setImmediate$argument_0
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:130:14 in _callTimer
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:181:14 in _callImmediatesPass
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:441:30 in callImmediates
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:387:6 in __callImmediates
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:135:6 in __guard$argument_0
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:364:10 in __guard
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:134:4 in flushedQueue
* [native code]:null in flushedQueue
* [native code]:null in invokeCallbackAndReturnFlushedQueue

please refer to this:

I found out what causes this error. “module-resolver”
after I added this code on a new project with SDK40 and “expo start -c” the same error occurred.
but it was working with SDK39.

babel.config.js

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ["babel-preset-expo"],
    plugins: [
      [
        "module-resolver",
        {
          root: ["./"],
          extensions: [".js", ".ios.js", ".android.js", ".fx.js", ".ts"],
          alias: {
            "@screens": "./screens",
            "@assets": "./assets",
            "@images": "./assets/images",
            "@constants": "./constants",
            "@components": "./components",
            "@UI": "./components/UI",
            "@actions": "./store/actions",
            "@reducers": "./store/reducers",
            "@models": "./models",
            "@navigation": "./navigation",
            "@util": "./util",
          },
        },
      ],
      ["@babel/plugin-syntax-class-properties"],
    ],
  };
};

1 Like

maybe try leaving out the extensions option? i don’t use this babel plugin so i can’t help much here, but i am glad that you were able to find the source of the problem!

I did remove the extensions and even changed the alias names but it is not working.
only it works when "module-resolver" is removed.

you could try to reproduce it in a new project, and see what the minimal code is that is needed to cause this problem. i believe this is quite a popular babel plugin used by many others, so there is likely some other code interacting with module resolver here. i outlined some steps to help do that in the doc i shared above

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.