hermes icon indicating copy to clipboard operation
hermes copied to clipboard

Thread 6: "Exception NSException * "Unhandled JS Exception: Error: invalid host, js engine: hermes"

Open hacnam0306 opened this issue 2 years ago • 32 comments

image **Thread 6: "Exception NSException * "Unhandled JS Exception: Error: invalid host, js engine: hermes" when building release schema with react native 0.70.2** It's only occur in release mode , when debugging it's run normally

hacnam0306 avatar Dec 23 '23 05:12 hacnam0306

Hi, I am sorry you are having this problem, but unfortunately your report doesn't provide enough information to diagnose it, or even to identify that Hermes is the culprit. Unless you can provide a detailed reproduction with the latest version of Hermes, there is not much we can do.

tmikov avatar Dec 23 '23 18:12 tmikov

same thing happening to me, only in RELEASE, react native app, it happens whenever i try to launch the app, always crashing on launch,

any update your end ? @hacnam0306

"Unhandled JS Exception: Error: invalid host, js engine: hermes"

karam1ashqar avatar Dec 24 '23 19:12 karam1ashqar

same thing happening to me, only in RELEASE, react native app, it happens whenever i try to launch the app, always crashing on launch,

any update your end ? @hacnam0306

"Unhandled JS Exception: Error: invalid host, js engine: hermes"

same bro

hacnam0306 avatar Dec 25 '23 00:12 hacnam0306

Also been having the same issue, anyone figured out the solution?

Abramovick avatar Dec 28 '23 01:12 Abramovick

Note that this exception is coming from React Native, not Hermes. AFACT, it is thrown from one of these locations:

  • https://github.com/facebook/react-native/blob/d992abc56d02a5a0f025d9252b56c3f7c6ce8945/packages/react-native/React/CoreModules/RCTExceptionsManager.mm#L79
  • https://github.com/facebook/react-native/blob/d992abc56d02a5a0f025d9252b56c3f7c6ce8945/packages/react-native/React/CxxModule/RCTCxxUtils.mm#L50

I recommend trying with the latest versions of RN and asking in React Native.

tmikov avatar Dec 28 '23 05:12 tmikov

Same problem here using RN 0.73.1. Any news on that issue?

luanlcampos avatar Dec 29 '23 14:12 luanlcampos

It was an npm issue for me, I had npm install with --force or legacy peer reps to fix it

karam1ashqar avatar Dec 29 '23 14:12 karam1ashqar

same thing happening to me, only in RELEASE, react native app, it happens whenever i try to launch the app, always crashing on launch,

any update your end ? @hacnam0306

"Unhandled JS Exception: Error: invalid host, js engine: hermes"

Same issue here, RN 0.71.14. Only on production IOS.

matheusPcruz18 avatar Dec 29 '23 15:12 matheusPcruz18

hi guys , i fixed it randomly by remove some useless library , checkout the version of reanimated , clean project by delete yarn.lock & node module and reinstall again <3

hacnam0306 avatar Dec 29 '23 15:12 hacnam0306

hacnam0306 Any further update on this? can you please share more details on this -? useless library , checkout the version of reanimated

nishadthajudeen001 avatar Jan 03 '24 12:01 nishadthajudeen001

Reactotron was causing the issue in release mode, I was able to fix that by commenting out the reactotron code during the release build.

nishadthajudeen001 avatar Jan 04 '24 08:01 nishadthajudeen001

Reactotron was causing the issue in release mode, I was able to fix that by commenting out the reactotron code during the release build.

Could you please elaborate on the same issue,thanks @nishadthajudeen001

liylmn avatar Jan 04 '24 11:01 liylmn

Reactotron was causing the issue in release mode, I was able to fix that by commenting out the reactotron code during the release build.

Could you please elaborate on the same issue,thanks @nishadthajudeen001

Only the Release version APP was crashing with this error for us -"Error: invalid host, js engine: hermes",

This issue got resolved when we took the release after commenting out the Reactotron code.

nishadthajudeen001 avatar Jan 04 '24 14:01 nishadthajudeen001

Reactotron was causing the issue in release mode, I was able to fix that by commenting out the reactotron code during the release build.

Could you please elaborate on the same issue,thanks @nishadthajudeen001

Only the Release version APP was crashing with this error for us -"Error: invalid host, js engine: hermes",

This issue got resolved when we took the release after commenting out the Reactotron code.

bro, thank you so much. Just delete these few libraries reactotron-react-native reactotron-redux reactotron-redux-saga

liylmn avatar Jan 05 '24 09:01 liylmn

Reactotron was causing the issue in release mode, I was able to fix that by commenting out the reactotron code during the release build.

Could you please elaborate on the same issue,thanks @nishadthajudeen001

Only the Release version APP was crashing with this error for us -"Error: invalid host, js engine: hermes", This issue got resolved when we took the release after commenting out the Reactotron code.

bro, thank you so much. Just delete these few libraries reactotron-react-native reactotron-redux reactotron-redux-saga

I can confirm. Removing reactotron and reactotron related libraries fixed it.

vinesh4Real avatar Jan 06 '24 01:01 vinesh4Real

Reactotron was causing the issue in release mode, I was able to fix that by commenting out the reactotron code during the release build.

Could you please elaborate on the same issue,thanks @nishadthajudeen001

Only the Release version APP was crashing with this error for us -"Error: invalid host, js engine: hermes", This issue got resolved when we took the release after commenting out the Reactotron code.

bro, thank you so much. Just delete these few libraries reactotron-react-native reactotron-redux reactotron-redux-saga

I can confirm. Removing reactotron and reactotron related libraries fixed it.

After wasting whole day your soln worked. Any way to keep reactotron also and app crash free

Ajmal0197 avatar Jan 09 '24 14:01 Ajmal0197

There is no need for library uninstallation, for now I am manually commenting or uncommenting every reactotron instance during release or debug mode.

Ajmal0197 avatar Jan 09 '24 15:01 Ajmal0197

So, this looks like a problem in Reactotron? @Ajmal0197 I see you reported it to Infinite Red, but then closed the issue?

tmikov avatar Jan 09 '24 18:01 tmikov

So, this looks like a problem in Reactotron? @Ajmal0197 I see you reported it to Infinite Red, but then closed the issue?

It's temporarily solved will reopen it. Forgot to reopen.

Ajmal0197 avatar Jan 09 '24 18:01 Ajmal0197

@Ajmal0197 @tmikov I managed to solve it. Make sure you dont import anything unless you are in development mode.

In our entry file, we were careful to import our reactotron config file (has all the tron config and imports) only if we are in dev mode. Like so,

if (__DEV__) {
  import('./ReactotronConfig').then(() =>
    // eslint-disable-next-line no-console
    console.tron.log('Reactotron Configured'),
  );
}

But we were also using redux enhancers in our redux store declaration, where the import existed regardless of the environment. This is where the error was from. I solved it by importing only after confirming dev environment,

let getEnhancers = () => {
  if (process.env.NODE_ENV === 'development') {
    const reactotron = require('../../ReactotronConfig').default;
    [reactotron.createEnhancer!()];
  }
  return [];
};

const store = configureStore({
  reducer: rootReducer,
  enhancers: getEnhancers(),
});

vinesh4Real avatar Jan 09 '24 20:01 vinesh4Real

let getEnhancers = () => { if (process.env.NODE_ENV === 'development') { const reactotron = require('../../ReactotronConfig').default; [reactotron.createEnhancer!()]; } return []; };

This worked for me thanks:

const getEnhancers = (getDefaultEnhancers) => {
  if (process.env.NODE_ENV === 'development') {
    const reactotron = require('../helpers/ReactotronConfig').default;
    return getDefaultEnhancers().concat(reactotron.createEnhancer());
  }
  return getDefaultEnhancers();
};

// https://redux-toolkit.js.org/usage/usage-guide#use-with-redux-persist
const store = configureStore({
  reducer: persistedReducer,
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware({
      serializableCheck: {
        ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER], //
      },
    }),
  enhancers: getEnhancers,
});

Ajmal0197 avatar Jan 10 '24 05:01 Ajmal0197

SIGABRT: Unhandled JS Exception: Error: invalid host, js engine: hermes I too getting this same error,that too only in production..I tried it using iphone SE ios version 17+

lachu97 avatar Jan 10 '24 11:01 lachu97

@Ajmal0197 Dont you need to call that function?

vinesh4Real avatar Jan 10 '24 13:01 vinesh4Real

@Ajmal0197 Dont you need to call that function?

Already calling see last line. Also u can follow this https://github.com/infinitered/reactotron/issues/1398

Ajmal0197 avatar Jan 10 '24 13:01 Ajmal0197

@Ajmal0197 that's what I mean, you assigned it but its not called. Add open close brackets getEnhancers()

vinesh4Real avatar Jan 10 '24 13:01 vinesh4Real

@Ajmal0197 that's what I mean, you assigned it but its not called. Add open close brackets getEnhancers() Se

We can use like this in es6. It's working i have checked properly in release/debug mode

Ajmal0197 avatar Jan 10 '24 13:01 Ajmal0197

I just removed all reactotron code from my project and it worked. Thank you guys.

matheusPcruz18 avatar Jan 10 '24 15:01 matheusPcruz18

check this link https://github.com/infinitered/reactotron/issues/1398, latest build 5.0.4 is the culprit for the issue. We will continue to comment out when we take release build still reactotron resolve the issue

nishadthajudeen001 avatar Jan 10 '24 15:01 nishadthajudeen001

Change reactotron-react-native in package.json to 5.0.3, instead of ^5.0.3, otherwise the actual version of reactotron-react-native in node_modules is 5.0.4

TrustDec avatar Jan 17 '24 06:01 TrustDec

Hello, I remove the dependencies from reactotron-react-native, reactotron-redux, reactotron-redux-saga and reactotron-plugin-zustand works for me, thank you for advices @nishadthajudeen001 !

sebasgarcia29 avatar Jan 17 '24 16:01 sebasgarcia29