Skip to content

Conversation

@mxs
Copy link
Contributor

@mxs mxs commented Mar 23, 2020

This PR fixes a crash in @sentry/react-native v1.3.3 on startup, caused by assuming global.document.createElement exists (hence assuming web context).

This PR just makes sure global.document.createElement is a function before actually calling it.

  • React native uses JavascriptCore and Hermes, global.document in those environments only contains addEventListener and removeEventListener and nothing else.
  • In the following commit in @sentry/react-native, line 46 of sdk.ts, fetch:false was removed. fetch:false prevented the crash from happening by bypassing the fetch instrumentation. Hence the mentioned commit triggered an existing bug within sentry-javascript. This bug appeared for us when we upgraded @sentry/react-native from v1.2.1 to v1.3.3

- check for global.document.createElement to be function before  calling
@mxs mxs requested a review from kamilogorek as a code owner March 23, 2020 07:40
@kamilogorek kamilogorek merged commit 124e71e into getsentry:master Mar 23, 2020
@kamilogorek
Copy link
Contributor

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants