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

ErrorAbstract is freezing Hermes engine (React Native) #547

Open
sesm opened this issue Mar 15, 2023 · 4 comments
Open

ErrorAbstract is freezing Hermes engine (React Native) #547

sesm opened this issue Mar 15, 2023 · 4 comments

Comments

@sesm
Copy link

sesm commented Mar 15, 2023

This line of code in ErrorAbstract is freezing Hermes JS engine in React Native applications:
https://github.com/GetStream/stream-js/blob/main/src/errors.ts#L21

Please see minimal example React Native app here: https://github.com/sesm/rn-gestream-freeze

Related Hermes issue: facebook/hermes#928

@sesm sesm changed the title ErrorAbstract is freezing Hermes engine ErrorAbstract is freezing Hermes engine (React Native) Mar 15, 2023
@sesm
Copy link
Author

sesm commented Mar 16, 2023

Comment from Hermes team:

There is a bug in GetStream's AbstractError constructor. The call should be Error.captureStackTrace(this, AbstractError), and not Error.captureStackTrace(this, AbstractError.constructor).

( facebook/hermes#928 (comment) )

@nickstamas
Copy link

@sesm Thank you for reporting. I've been banging my head up against the wall on this one.

@sesm
Copy link
Author

sesm commented Mar 18, 2023

@nickstamas you are welcome! Here is a workaround patch just in case (copied from patch-package output):

diff --git a/node_modules/getstream/lib/errors.js b/node_modules/getstream/lib/errors.js
index 51108e3..80b9e7d 100644
--- a/node_modules/getstream/lib/errors.js
+++ b/node_modules/getstream/lib/errors.js
@@ -49,7 +49,7 @@ var ErrorAbstract = /*#__PURE__*/function (_Error) {
     (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "message", void 0);
     _this.message = msg;
 
-    if (canCapture) {
+    if (false) {
       Error.captureStackTrace((0, _assertThisInitialized2.default)(_this), ErrorAbstract.constructor);
     } else if (canStack) {
       _this.stack = new Error().stack;

@TwistedMinda
Copy link

@sesm Thanks for this! That's now 2 heads saved from wall banging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants