Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot convert undefined value to object, js engine: hermes #25634

Closed
xxRockOnxx opened this issue Jul 13, 2019 · 9 comments
Closed

Cannot convert undefined value to object, js engine: hermes #25634

xxRockOnxx opened this issue Jul 13, 2019 · 9 comments
Labels
Bug Platform: Linux Building on Linux. Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Hermes Hermes Engine: https://hermesengine.dev/

Comments

@xxRockOnxx
Copy link

Setting enableHermes to true would cause Cannot convert undefined value to object, js engine: hermes.

Confirmed it by setting the value to false and rebuilding.

React Native version:
System:
OS: Linux 5.0 Antergos Linux undefined
CPU: (8) x64 Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
Memory: 2.91 GB / 7.77 GB
Shell: 5.7.1 - /usr/bin/zsh
Binaries:
Node: 11.14.0 - /usr/bin/node
Yarn: 1.16.0 - /usr/bin/yarn
npm: 6.9.0 - /usr/bin/npm
SDKs:
Android SDK:
API Levels: 28
Build Tools: 28.0.3
IDEs:
Android Studio: 3.3
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.3 => 0.60.3

Steps To Reproduce

  1. Follow upgrade guide from 0.60.0 to 0.60.3
  2. enable enableHermes in app/build.gradle
  3. ./gradlew clean
  4. react-native run-android

Describe what you expected to happen:
Should work just fine as before.

@xxRockOnxx xxRockOnxx added the Bug label Jul 13, 2019
@react-native-bot react-native-bot added the Platform: Linux Building on Linux. label Jul 13, 2019
@ithustle
Copy link

Anything?

@react-native-bot react-native-bot added the Tech: Hermes Hermes Engine: https://hermesengine.dev/ label Jul 17, 2019
@rszalski
Copy link

@xxRockOnxx Try debugging JS in Chrome debugger and enable „Pause on exceptions”. This way you should be able to at least see where the problem originates. It would be good to have a minimal reproducible example to work with.

I had the same issue but it turned out that it wasn’t actually Hermes (actually it was Reactotron trying to notify me of subscriptions to an incorrectly configured Redux store). I’m mentioning this because I also though that disabling Hermes fixed the issue, but it was only coincidentally related and stateful.

@xxRockOnxx
Copy link
Author

That's weird. The error mentioned in the OP is not showing up anymore.

I re-enabled the enableHermes option and tried the suggestion of @rszalski but it just worked and build without any exceptions.

Pretty sure I did not changed anything as I went out of town since I opened this issue and Git status did not show any changes (aside from re-enabling the enableHermes)

@hackdie
Copy link

hackdie commented Jul 23, 2019

having same error, any idea?

@rszalski
Copy link

rszalski commented Jul 23, 2019

having same error, any idea?

@hackdie this is probably not a Hermes-related error but rather a normal JS error. The string js engine: hermes is there just to inform you that you've enabled Hermes correctly, and is not part of the actual error text. But it can be confusing at first.

If debugging in chrome doesn't yield an answer, there is a blunt way of debugging this:
try doing a binary search on your components (meaning, comment half of them out, see if the error is there, if not, comment the other half out, etc.) to pinpoint where this originates. It's possible that you are just passing an undefined where an object is expected.

There might be something that makes Hermes more susceptible to this issue (which would give the perception of being caused by Hermes), but I don't know the internals, just a thought.

@mikefogg
Copy link

I just wanted to throw it out there that I know this isn't super helpful, but I'm getting the same issue when using Hermes only. I tried simplifying things down as much as possible, but am currently only seeing this issue:

  1. On the first load after a fresh install (before a reload)
  2. When Hermes is enabled

I simplified things as much as possible, and my App.js is now simply:

# App.js

import React from 'react'
import { View, Text } from 'react-native'

const App = () => {
  return (
    <View style={{ backgroundColor: 'red', height: 200 }}>
        <Text>Here is text</Text>
    </View>
  )
}

export default App

and index.android.js is:

# index.android.js

import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';

AppRegistry.registerComponent(appName, () => App);

Screen Shot 2019-08-20 at 2 44 20 PM

I can't see where in there I could be introducing a JS error... any thoughts on what may be causing this or any other debugging? Since it's happening before I can connect to the Debugger it's not an easy one. Disabling Hermes fixes the issue for now...

@DaniAkash
Copy link

It happened when inlineRequires are enabled in metro.config.js. Try disabling it and run the build again...

module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: true,
        inlineRequires: false
      }
    })
  }
};

@stale
Copy link

stale bot commented Nov 20, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 20, 2019
@stale
Copy link

stale bot commented Nov 27, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Nov 27, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Nov 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Linux Building on Linux. Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Hermes Hermes Engine: https://hermesengine.dev/
Projects
None yet
Development

No branches or pull requests

7 participants