expo: undefined is not an object (evaluating 'u.default.Mode')

๐Ÿ› Bug Report

Environment

Expo CLI 2.19.5 environment info: System: OS: macOS 10.14.5 Shell: 3.2.57 - /bin/bash Binaries: Node: 12.4.0 - /usr/local/bin/node Yarn: 1.13.0 - /usr/local/bin/yarn npm: 6.9.0 - /usr/local/bin/npm IDEs: Xcode: /undefined - /usr/bin/xcodebuild npmGlobalPackages: expo-cli: 2.19.5

Steps to Reproduce

Itโ€™s hard to reproduce. I upgraded my huge project from expo 32 to 33. I really do not know what can cause a problem. Problem exists only on iOS. Android works like a charm.

Expected Behavior

Standalone application starts correctly.

Actual Behavior

Standalone application is not starting. In my device logs there is something like: undefined is not an object (evaluating 'u.default.Mode')

image image

Reproducible Demo

It is hard to reproduce it because it only happens in a production build. Application is working correctly in a development mode ( started with an Expo app )

I started using BackgroundFetch feature so I added property UIBackgroundModes to my app.json file. Do you think it could be related?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 21 (7 by maintainers)

Most upvoted comments

@brentvatne here is a stripped down example: https://github.com/kuritz/expo-test

There are 3 builds from the 3 branches. The error only occurs on the sdk 33 branch that uses face detector for me.

Hope this helps, let me know if you were looking for something else.

Hereโ€™s my diagnostic printout:

expo diagnostics (sdk-32)

  Expo CLI 2.20.2 environment info:
    System:
      OS: Linux 4.18 Ubuntu 18.04.2 LTS (Bionic Beaver)
      Shell: 5.4.2 - /usr/bin/zsh
    Binaries:
      Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
      Yarn: 1.16.0 - ~/.yarn/bin/yarn
      npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
    npmPackages:
      expo: ^32.0.0 => 32.0.6 
      react: 16.5.0 => 16.5.0 
      react-native: https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz => 0.57.1 
      react-navigation: ^2.18.2 => 2.18.3 
    npmGlobalPackages:
      expo-cli: 2.20.2

expo diagnostics (sdk-33)

  Expo CLI 2.20.2 environment info:
    System:
      OS: Linux 4.18 Ubuntu 18.04.2 LTS (Bionic Beaver)
      Shell: 5.4.2 - /usr/bin/zsh
    Binaries:
      Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
      Yarn: 1.16.0 - ~/.yarn/bin/yarn
      npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
    npmPackages:
      expo: ^33.0.0 => 33.0.6 
      react: 16.8.3 => 16.8.3 
      react-native: https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz => 0.59.8 
      react-navigation: ^2.18.2 => 2.18.3 
    npmGlobalPackages:
      expo-cli: 2.20.2

This was fixed with an update to Home for SDK 33.

Iโ€™ve made a little investigation. I cloned expo/expo and greped for u.default.Mode. It found

Exponent/Supporting/kernel.ios.bundle:__d(function(g,r,i,a,m,e,d){var t=r(d[0]);Object.defineProperty(e,"__esModule",{value:!0}),e.detectFacesAsync=function(t){var o,f=arguments;return n.default.async(function(l){for(;;)switch(l.prev=l.next){case 0:if(o=f.length>1&&void 0!==f[1]?f[1]:{},u.default.detectFaces){l.next=3;break}throw new c.UnavailabilityError('expo-face-detector','detectFaces');case 3:return l.next=5,n.default.awrap(u.default.detectFaces((0,s.default)({},o,{uri:t})));case 5:return l.abrupt("return",l.sent);case 6:case"end":return l.stop()}})},e.Constants=void 0;var n=t(r(d[1])),s=t(r(d[2])),c=r(d[3]),u=t(r(d[4]));var o={Mode:u.default.Mode,Landmarks:u.default.Landmarks,Classifications:u.default.Classifications};e.Constants=o},851,[1,110,52,573,852]);

Interesting part is:

    var o = {
        Mode: u.default.Mode,
        Landmarks: u.default.Landmarks,
        Classifications: u.default.Classifications
    };

Then I looked for Mode: and i found:

packages/expo-face-detector/src/FaceDetector.ts:  Mode: ExpoFaceDetector.Mode,
export const Constants = {
  Mode: ExpoFaceDetector.Mode,
  Landmarks: ExpoFaceDetector.Landmarks,
  Classifications: ExpoFaceDetector.Classifications,
};

So maybe there is a bug in ExpoFaceDetector module? Itโ€™s a blind shot but maybe?