Hermes: `Object.getOwnPropertyDescriptors` is not available in Hermes, RN 0.62.2

Created on 19 Jun 2020  路  6Comments  路  Source: facebook/hermes

We got some bug reports that immer@7 is broken on Hermes engine. From debugging it seems that Object.getOwnPropertyDescriptors is not defined in Hermes (in contrast to Object.getOwnPropertyDescriptor). See screenshot:

Screen Shot 2020-06-19 at 16 31 29

Minimal reproduction test project is available in the original issue: https://github.com/immerjs/immer/issues/626#issue-642052322

(P.s. would be great if the error message could be improved from TypeError: undefined is not a function to something like Uncaught TypeError: Object.bla is not a function at <anonymous>:1:8 as is done in Chrome for example)

Most helpful comment

@mweststrate In terms of the error message: the general issue is that Hermes doesn't typically run directly on source but by executing bytecode, so it doesn't have access to source level expressions like Object.bla, and adding support for that is a significant amount of design work with tradeoffs we haven't fully investigated. The solution that we're trying to rely on instead is to use the line/column numbers, and it looks like they worked for you in this case.

If the line/column numbers are ever incorrect (they're too large, for example, indicating bytecode addresses instead of actual source locations) and you have some useful reproduction instructions, then you can file an issue in the React Native repository, since the symbolication logic for RN lives over there. We're trying to make sure the debugging experience is as smooth as it can be given that the Hermes execution model is different from most other ways of running JS.

All 6 comments

That's because it's in ES2017, and Hermes only implements ES2015.

@mweststrate I'll look into implementing this soon, thanks for the report.

@ljharb Hermes implements various features past ES2015 (particularly in terms of library functions), just missed this one.

@ljharb well, IE 9 has it, we can't do less than that 馃槒

EDIT: never mind, that s in the end is really hard :-P.

@avp awesome, thanks!

@mweststrate In terms of the error message: the general issue is that Hermes doesn't typically run directly on source but by executing bytecode, so it doesn't have access to source level expressions like Object.bla, and adding support for that is a significant amount of design work with tradeoffs we haven't fully investigated. The solution that we're trying to rely on instead is to use the line/column numbers, and it looks like they worked for you in this case.

If the line/column numbers are ever incorrect (they're too large, for example, indicating bytecode addresses instead of actual source locations) and you have some useful reproduction instructions, then you can file an issue in the React Native repository, since the symbolication logic for RN lives over there. We're trying to make sure the debugging experience is as smooth as it can be given that the Hermes execution model is different from most other ways of running JS.

Added in ad42e5c9a60cf3794de5cd8a79a638cb8b18573f

Awesome, thanks @avp!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gaodeng picture gaodeng  路  4Comments

mathiasbynens picture mathiasbynens  路  6Comments

benjamingr picture benjamingr  路  6Comments

thymikee picture thymikee  路  6Comments

willholen picture willholen  路  4Comments