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

buffer v5.x dependency crashes on Android 8 and earlier #81

Closed
noahfpf opened this issue Sep 9, 2019 · 3 comments
Closed

buffer v5.x dependency crashes on Android 8 and earlier #81

noahfpf opened this issue Sep 9, 2019 · 3 comments
Assignees

Comments

@noahfpf
Copy link

noahfpf commented Sep 9, 2019

In both the emulator and on devices running older versions of Android (tested with 8.0 and 6.0), our application crashes when importing from buffer (5.4.2), which is a dependency of rollbar-react-native (version 0.5.0).

The crash comes at this line:

Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)

https://github.com/feross/buffer/blob/v5.4.2/index.js#L186

And just before that, the following warning is logged by buffer:

"This browser lacks typed array (Uint8Array) support which is required by buffer v5.x. Use buffer v4.x if you require old browser support."

I think we've fixed this problem by requiring buffer ^4.9.1 instead, though I'm not yet sure what repercussions that might have. We added this to package.json:

  "resolutions": {
    "rollbar-react-native/buffer": "^4.9.1",
  },

Possibly related: facebook/react-native#1424

Any idea whether buffer v4 is sufficient for basic rollbar logging and exception catching?

Relevant log lines:

09-09 14:58:33.897 27501 27558 E ReactNativeJS: This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.
09-09 14:58:33.901 27501 27558 E ReactNativeJS: undefined is not a function (evaluating 'Object.setPrototypeOf(s.prototype,Uint8Array.prototype)')
@waltjones
Copy link
Contributor

@noahfpf Thanks for the report. Seems strange, since that dependency was added in Sep. 2017 when Android 8 (and earlier) were pretty mainstream.

I'll test here and see if 4.x is sufficient.

@waltjones waltjones self-assigned this Sep 9, 2019
@spacesuitdiver
Copy link

Worth noting this version pinning only works with yarn it seems.

@waltjones
Copy link
Contributor

Fixed in 0.6.1. PR: #83

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