stream-js
stream-js copied to clipboard
ErrorAbstract is freezing Hermes engine (React Native)
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: https://github.com/facebook/hermes/issues/928
Comment from Hermes team:
There is a bug in GetStream's
AbstractErrorconstructor. The call should beError.captureStackTrace(this, AbstractError), and notError.captureStackTrace(this, AbstractError.constructor).
( https://github.com/facebook/hermes/issues/928#issuecomment-1472584542 )
@sesm Thank you for reporting. I've been banging my head up against the wall on this one.
@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;
@sesm Thanks for this! That's now 2 heads saved from wall banging