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

Add Support for React Native for Web (& Expo) #859

Closed
wants to merge 16 commits into from

Conversation

daxfrost
Copy link

@daxfrost daxfrost commented May 19, 2020

What

This PR introduces React Native for Web support to pure/vanilla (not Expo) React Native projects using Rollbar, and is dependent on another PR for the rollbar-react-native repository.

It's important to understand that Expo & React Native have fundamental differences, Expo is not vanilla React Native, and thus does not support any custom native libraries and cannot use the rollbar-react-native package, for this reason the ErrorUtils layer has been moved into this repository (rollbar.js) and can be initialized directly - although the Configuration object that resides in the rollbar-react-native repository's ./src/Rollbar.js may be useful to import and use when initializing it from Expo. An issue that is resolved by this PR is mentioned here.

The second important difference to understand is that React Native for Web is not compatible with ErrorUtils used by native app's JS layer, ErrorUtils is a custom global object of react-native itself, and designed for the JavaScriptCore headless engine that runs the JS code on Android & iOS devices. React Native for Web, however, runs on any web browser, re-using the code of the consumer's project - it can support ignoring the native libraries, unlike Expo. But it also means that it cannot depend on ErrorUtils for catching global errors, this is catered for in the dependent PR.

Changes

  • Added ErrorUtils uncaught exception & unhandled promise rejection handlers for JavaScriptCore supporting React Native layer
  • Added Browser specific uncaught exception & unhandled promise rejection handlers for React Native for Web

@daxfrost
Copy link
Author

daxfrost commented May 19, 2020

Hi @waltjones,

I'm excited to finally share this with you, and get your feedback.

I have tested Android, iOS & Web, and all run successfully with no errors in the consoles.

I have also test all platforms forcing an exception, and verified they are tracked correctly to Rollbar dashboard.

@daxfrost daxfrost marked this pull request as ready for review May 19, 2020 21:34
@daxfrost
Copy link
Author

daxfrost commented May 20, 2020

Hi @waltjones,

if you could help me, I'm trying to resolve the issues with the CI.

The issue that it's getting is fairly trivial stuff that I can fix - however, I cannot understand how to reproduce it locally.

I have run npm run test_ci which has the following output, and seems like it doesn't complete, is there something I need to get this working locally?

npm run test

> rollbar@2.16.2 test /Users/dbooysen/Documents/dev/rollbar.js
> grunt test

Running "test-server" task

Running "vows:all" (vows) task

  ♢ parser

  parseStack a valid stack trace
    ✓ should parse valid js frame
    ✓ should parse valid ts frame
    ✓ should parse method with parens
    ✓ should parse without method and with leading slash
    ✓ should parse without method or parens
    ✓ should parse method with angle brackets

  ♢ predicates

  checkLevel an item without a level settings with a critical reportLevel
    ✓ should not send
  checkLevel an item with an unknown level settings with an error reportLevel
    ✓ should not send
  checkLevel an item with an unknown level settings with an unknown reportLevel
    ✓ should send
  checkLevel an item with an unknown level settings without a reportLevel
    ✓ should send
  checkLevel an item with a warning level settings with an error reportLevel
    ✓ should not send
  checkLevel an item with a warning level settings with an info reportLevel
    ✓ should send
  checkLevel an item with a warning level settings with a warning reportLevel
    ✓ should send

  ♢ rollbar

  buildJsonPayload
    ✓ should work
  sendJsonPayload
    ✓ should work
  singleton
    ✓ should allow log on constructor to pass through
  constructor with accessToken
    ✓ should have log method
    ✓ should have error method
    ✓ should have buildJsonPayload method
    ✓ should have sendJsonPayload method
    ✓ should have accessToken in options
  constructor with options
    ✓ should have log method
    ✓ should have error method
    ✓ should have accessToken in options
    ✓ should set environment based on default
  constructor with more options
    ✓ should have log method
    ✓ should have error method
    ✓ should have accessToken in options
    ✓ should set environment based on options
    ✓ should set configured options
  configure with updated options
    ✓ should set configured options
  log info
    ✓ should send message when called with only null argument
    ✓ should send message when called with no arguments
  log message with unordered options
    ✓ should work with custom, request, callback, message
  log message with old option ordering
    ✓ should work
    ✓ should work with callback
    ✓ should work with request
    ✓ should work with request and callback
    ✓ should work with request and custom
    ✓ should work with request and custom and callback
  log error with unordered options
    ✓ should work with custom, request, callback, message
  log error with old option ordering
    ✓ should work
    ✓ should work with callback
    ✓ should work with request
    ✓ should work with request and callback
    ✓ should work with request and custom
    ✓ should work with request and custom and callback
  captureUncaught enabled in constructor
    ✓ should log
  captureUnhandledRejections enabled in constructor
    ✓ should log
  captureUncaught enabled in constructor disabled in configure
    ✓ should not log
  captureUnhandledRejections enabled in constructor disabled in configure
    ✓ should not log
  captureUncaught enabled in constructor disabled in configure disabled in constructor
    ✓ should not log
  captureUnhandledRejections enabled in constructor disabled in configure disabled in constructor
    ✓ should not log
  captureUncaught enabled in constructor disabled in configure disabled in constructor enabled in configure
    ✓ should log
  captureUnhandledRejections enabled in constructor disabled in configure disabled in constructor enabled in configure
    ✓ should log

  ♢ transforms

  baseData options defaults item empty
    ✓ should have a timestamp
    ✓ should have an error level
    ✓ should have some defaults
  baseData options defaults item with values
    ✓ should have a critical level
    ✓ should have the defaults overriden by the item
    ✓ should have data from custom
  baseData options with values item empty
    ✓ should have a timestamp
    ✓ should have an error level
    ✓ should have data from options and defaults
  baseData options with values item with values
    ✓ should have a critical level
    ✓ should have the defaults overriden by the item
    ✓ should have data from custom
  addBody options anything item with stackInfo
    ✓ should not error
    ✓ should set the trace_chain
    ✓ should not set a message
  addBody options anything item with no stackInfo
    ✓ should not error
    ✓ should not set the trace_chain
    ✓ should set a message
  addMessageData options anything item no message
    ✓ should not error
    ✓ should add an empty body
  addMessageData options anything item with a message
    ✓ should not error
    ✓ should add a body with the message
  handleItemWithError options anything item no error
    ✓ should not error
    ✓ should not change the item
  handleItemWithError options anything item with a simple error
    ✓ should not error
    ✓ should add some data to the trace_chain
  handleItemWithError options anything item with a normal error
    ✓ should not error
    ✓ should add some data to the trace_chain
  handleItemWithError options anything item with a nested error
    ✓ should not error
    ✓ should have the right data in the trace_chain
  handleItemWithError nodeSourceMaps
    ✓ should map the stack
  addRequestData options without custom addRequestData method without scrub fields item without a request
    ✓ should not error
    ✓ should not change the item
  addRequestData options without custom addRequestData method without scrub fields item with an empty request object
    ✓ should not error
    ✓ should not change request object
  addRequestData options without custom addRequestData method without scrub fields item with a request
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should set a person based on request user
    ✓ should set some fields based on request data
  addRequestData options without custom addRequestData method without scrub fields item with a request like from hapi
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should set a person based on request user
    ✓ should set some fields based on request data
  addRequestData options without custom addRequestData method without scrub fields item with a request with an array body
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should set a person based on request user
    ✓ should set some fields based on request data
  addRequestData options without custom addRequestData method with scrub fields item with a request
    ✓ should not error
    ✓ should have a request object inside data
  addRequestData options with custom addRequestData with scrub fields item with a request
    ✓ should not error
    ✓ should do what the function does
  scrubPayload options without scrub fields item
    ✓ should not error
    ✓ should not scrub okay keys
    ✓ should scrub key/value based on defaults
  scrubPayload options with scrub fields item with a request
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should scrub based on the options
  scrubPayload options with scrub fields item with a json request body
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should scrub based on the options
  scrubPayload options with scrub fields item with a bad json request body
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should delete the body and add a diagnostic error

  ♢ transport

  post with rate limiting
    ✓ should transmit non-rate limited requests
    ✓ should drop rate limited requests and set timeout
  post base data with no payload
    ✓ should have an error
  post base data with a payload and no error
    ✓ should not error
    ✓ should have the right response data
  post base data with a payload and an error in the response
    ✓ should error
    ✓ should have the message somewhere
    ✓ should not have a response
  post base data with a payload and an error during sending
    ✓ should error
    ✓ should have the message somewhere
    ✓ should not have a response
 ✓ OK » 129 honored (2.554s)


Running "test-browser" task

Running "karma:api" (karma) task
⚠ 「wdm」: Hash: d4e94cf661365475ea55
Version: webpack 4.43.0
Time: 76ms
Built at: 05/20/2020 11:05:31 AM

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
ℹ 「wdm」: Compiled with warnings.
ℹ 「wdm」: Compiling...
⚠ 「wdm」: Hash: 6fe16d08016ca92daa91
Version: webpack 4.43.0
Time: 2787ms
Built at: 05/20/2020 11:05:34 AM
           Asset     Size  Chunks                    Chunk Names
test/api.test.js  297 KiB       0  [emitted]  [big]  test/api.test
Entrypoint test/api.test [big] = test/api.test.js
[0] ./src/utility.js 123 KiB {0} [built]
[1] ./test/api.test.js 4.1 KiB {0} [built]
[2] ./src/api.js 12.6 KiB {0} [built]
[3] ./src/merge.js 11.4 KiB {0} [built]
[4] ./vendor/JSON-js/json3.js 24.5 KiB {0} [built]
[5] ./src/apiUtility.js 16.9 KiB {0} [built]
[6] ./src/truncation.js 20.4 KiB {0} [built]

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
ℹ 「wdm」: Compiled with warnings.
20 05 2020 11:05:34.659:INFO [karma-server]: Karma v5.0.4 server started at http://0.0.0.0:9876/
20 05 2020 11:05:34.660:INFO [launcher]: Launching browsers ChromeNoSandbox with concurrency unlimited
20 05 2020 11:05:34.667:INFO [launcher]: Starting browser ChromeHeadless
20 05 2020 11:05:35.969:INFO [Chrome Headless 81.0.4044.138 (Mac OS 10.15.4)]: Connected on socket -aaGntPcYbnV8ON9AAAA with id 18670493
Chrome Headless 81.0.4044.138 (Mac OS 10.15.4): Executed 4 of 4 SUCCESS (0.039 secs / 0.015 secs)
TOTAL: 4 SUCCESS

Running "karma:apiUtility" (karma) task
[1]    6747 segmentation fault  npm run test

@waltjones
Copy link
Contributor

@daxfrost It will be a few days before I can take a close look, but I'd suggest confirming you can npm run test on master.

@daxfrost
Copy link
Author

@waltjones thank you so much for getting back to me, I will do whatever I can you suggest until you're available.

I did test running npm run test on master before contacting you, and got the same result, with the segmentation fault (but not more detail unfortunately).

Here's the output of me trying on master:

➜  rollbar.js git:(daxfrost/react-native-web) git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
➜  rollbar.js git:(master) npm run test

> rollbar@2.16.2 test /Users/dbooysen/Documents/dev/rollbar.js
> grunt test

Running "test-server" task

Running "vows:all" (vows) task

  ♢ parser

  parseStack a valid stack trace
    ✓ should parse valid js frame
    ✓ should parse valid ts frame
    ✓ should parse method with parens
    ✓ should parse without method and with leading slash
    ✓ should parse without method or parens
    ✓ should parse method with angle brackets

  ♢ predicates

  checkLevel an item without a level settings with a critical reportLevel
    ✓ should not send
  checkLevel an item with an unknown level settings with an error reportLevel
    ✓ should not send
  checkLevel an item with an unknown level settings with an unknown reportLevel
    ✓ should send
  checkLevel an item with an unknown level settings without a reportLevel
    ✓ should send
  checkLevel an item with a warning level settings with an error reportLevel
    ✓ should not send
  checkLevel an item with a warning level settings with an info reportLevel
    ✓ should send
  checkLevel an item with a warning level settings with a warning reportLevel
    ✓ should send

  ♢ rollbar

  buildJsonPayload
    ✓ should work
  sendJsonPayload
    ✓ should work
  singleton
    ✓ should allow log on constructor to pass through
  constructor with accessToken
    ✓ should have log method
    ✓ should have error method
    ✓ should have buildJsonPayload method
    ✓ should have sendJsonPayload method
    ✓ should have accessToken in options
  constructor with options
    ✓ should have log method
    ✓ should have error method
    ✓ should have accessToken in options
    ✓ should set environment based on default
  constructor with more options
    ✓ should have log method
    ✓ should have error method
    ✓ should have accessToken in options
    ✓ should set environment based on options
    ✓ should set configured options
  configure with updated options
    ✓ should set configured options
  log info
    ✓ should send message when called with only null argument
    ✓ should send message when called with no arguments
  log message with unordered options
    ✓ should work with custom, request, callback, message
  log message with old option ordering
    ✓ should work
    ✓ should work with callback
    ✓ should work with request
    ✓ should work with request and callback
    ✓ should work with request and custom
    ✓ should work with request and custom and callback
  log error with unordered options
    ✓ should work with custom, request, callback, message
  log error with old option ordering
    ✓ should work
    ✓ should work with callback
    ✓ should work with request
    ✓ should work with request and callback
    ✓ should work with request and custom
    ✓ should work with request and custom and callback
  captureUncaught enabled in constructor
    ✓ should log
  captureUnhandledRejections enabled in constructor
    ✓ should log
  captureUncaught enabled in constructor disabled in configure
    ✓ should not log
  captureUnhandledRejections enabled in constructor disabled in configure
    ✓ should not log
  captureUncaught enabled in constructor disabled in configure disabled in constructor
    ✓ should not log
  captureUnhandledRejections enabled in constructor disabled in configure disabled in constructor
    ✓ should not log
  captureUncaught enabled in constructor disabled in configure disabled in constructor enabled in configure
    ✓ should log
  captureUnhandledRejections enabled in constructor disabled in configure disabled in constructor enabled in configure
    ✓ should log

  ♢ transforms

  baseData options defaults item empty
    ✓ should have a timestamp
    ✓ should have an error level
    ✓ should have some defaults
  baseData options defaults item with values
    ✓ should have a critical level
    ✓ should have the defaults overriden by the item
    ✓ should have data from custom
  baseData options with values item empty
    ✓ should have a timestamp
    ✓ should have an error level
    ✓ should have data from options and defaults
  baseData options with values item with values
    ✓ should have a critical level
    ✓ should have the defaults overriden by the item
    ✓ should have data from custom
  addBody options anything item with stackInfo
    ✓ should not error
    ✓ should set the trace_chain
    ✓ should not set a message
  addBody options anything item with no stackInfo
    ✓ should not error
    ✓ should not set the trace_chain
    ✓ should set a message
  addMessageData options anything item no message
    ✓ should not error
    ✓ should add an empty body
  addMessageData options anything item with a message
    ✓ should not error
    ✓ should add a body with the message
  handleItemWithError options anything item no error
    ✓ should not error
    ✓ should not change the item
  handleItemWithError options anything item with a simple error
    ✓ should not error
    ✓ should add some data to the trace_chain
  handleItemWithError options anything item with a normal error
    ✓ should not error
    ✓ should add some data to the trace_chain
  handleItemWithError options anything item with a nested error
    ✓ should not error
    ✓ should have the right data in the trace_chain
  handleItemWithError nodeSourceMaps
    ✓ should map the stack
  addRequestData options without custom addRequestData method without scrub fields item without a request
    ✓ should not error
    ✓ should not change the item
  addRequestData options without custom addRequestData method without scrub fields item with an empty request object
    ✓ should not error
    ✓ should not change request object
  addRequestData options without custom addRequestData method without scrub fields item with a request
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should set a person based on request user
    ✓ should set some fields based on request data
  addRequestData options without custom addRequestData method without scrub fields item with a request like from hapi
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should set a person based on request user
    ✓ should set some fields based on request data
  addRequestData options without custom addRequestData method without scrub fields item with a request with an array body
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should set a person based on request user
    ✓ should set some fields based on request data
  addRequestData options without custom addRequestData method with scrub fields item with a request
    ✓ should not error
    ✓ should have a request object inside data
  addRequestData options with custom addRequestData with scrub fields item with a request
    ✓ should not error
    ✓ should do what the function does
  scrubPayload options without scrub fields item
    ✓ should not error
    ✓ should not scrub okay keys
    ✓ should scrub key/value based on defaults
  scrubPayload options with scrub fields item with a request
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should scrub based on the options
  scrubPayload options with scrub fields item with a json request body
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should scrub based on the options
  scrubPayload options with scrub fields item with a bad json request body
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should delete the body and add a diagnostic error

  ♢ transport

  post with rate limiting
    ✓ should transmit non-rate limited requests
    ✓ should drop rate limited requests and set timeout
  post base data with no payload
    ✓ should have an error
  post base data with a payload and no error
    ✓ should not error
    ✓ should have the right response data
  post base data with a payload and an error in the response
    ✓ should error
    ✓ should have the message somewhere
    ✓ should not have a response
  post base data with a payload and an error during sending
    ✓ should error
    ✓ should have the message somewhere
    ✓ should not have a response
 ✓ OK » 129 honored (2.549s)


Running "test-browser" task

Running "karma:api" (karma) task
⚠ 「wdm」: Hash: d4e94cf661365475ea55
Version: webpack 4.43.0
Time: 69ms
Built at: 05/20/2020 12:07:19 PM

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
ℹ 「wdm」: Compiled with warnings.
ℹ 「wdm」: Compiling...
⚠ 「wdm」: Hash: a1767448bbf7693c8edc
Version: webpack 4.43.0
Time: 2352ms
Built at: 05/20/2020 12:07:22 PM
           Asset     Size  Chunks             Chunk Names
test/api.test.js  229 KiB       0  [emitted]  test/api.test
Entrypoint test/api.test = test/api.test.js
[0] ./src/utility.js 79.3 KiB {0} [built]
[1] ./test/api.test.js 4.1 KiB {0} [built]
[2] ./src/api.js 6.73 KiB {0} [built]
[3] ./src/merge.js 7.69 KiB {0} [built]
[4] ./vendor/JSON-js/json3.js 24.5 KiB {0} [built]
[5] ./src/apiUtility.js 11 KiB {0} [built]
[6] ./src/truncation.js 12.6 KiB {0} [built]

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
ℹ 「wdm」: Compiled with warnings.
20 05 2020 12:07:22.283:INFO [karma-server]: Karma v5.0.4 server started at http://0.0.0.0:9876/
20 05 2020 12:07:22.284:INFO [launcher]: Launching browsers ChromeNoSandbox with concurrency unlimited
20 05 2020 12:07:22.291:INFO [launcher]: Starting browser ChromeHeadless
20 05 2020 12:07:23.302:INFO [Chrome Headless 81.0.4044.138 (Mac OS 10.15.4)]: Connected on socket IVnGMX97XurXzBYBAAAA with id 23129666
Chrome Headless 81.0.4044.138 (Mac OS 10.15.4): Executed 4 of 4 SUCCESS (0.028 secs / 0.014 secs)
TOTAL: 4 SUCCESS
[1]    10317 segmentation fault  npm run test
➜  rollbar.js git:(master)

@waltjones
Copy link
Contributor

@daxfrost Segfault is an odd thing to be seeing here. I'd start with deleting node_modules and npm install.

@daxfrost
Copy link
Author

daxfrost commented May 20, 2020

@waltjones I agree that it's odd, hopefully we can figure this out, here's the output of me doing what you suggested:

➜  rollbar.js git:(master) rm -rf node_modules

➜  rollbar.js git:(master) npm install

> fsevents@1.2.13 install /Users/dbooysen/Documents/dev/rollbar.js/node_modules/watchpack/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node

> core-js@2.6.11 postinstall /Users/dbooysen/Documents/dev/rollbar.js/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

added 1104 packages from 1472 contributors and audited 1106 packages in 54.314s

29 packages are looking for funding
  run `npm fund` for details

found 1 high severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
➜  rollbar.js git:(master) npm run test

> rollbar@2.16.2 test /Users/dbooysen/Documents/dev/rollbar.js
> grunt test

Running "test-server" task

Running "vows:all" (vows) task

  ♢ parser

  parseStack a valid stack trace
    ✓ should parse valid js frame
    ✓ should parse valid ts frame
    ✓ should parse method with parens
    ✓ should parse without method and with leading slash
    ✓ should parse without method or parens
    ✓ should parse method with angle brackets

  ♢ predicates

  checkLevel an item without a level settings with a critical reportLevel
    ✓ should not send
  checkLevel an item with an unknown level settings with an error reportLevel
    ✓ should not send
  checkLevel an item with an unknown level settings with an unknown reportLevel
    ✓ should send
  checkLevel an item with an unknown level settings without a reportLevel
    ✓ should send
  checkLevel an item with a warning level settings with an error reportLevel
    ✓ should not send
  checkLevel an item with a warning level settings with an info reportLevel
    ✓ should send
  checkLevel an item with a warning level settings with a warning reportLevel
    ✓ should send

  ♢ rollbar

  buildJsonPayload
    ✓ should work
  sendJsonPayload
    ✓ should work
  singleton
    ✓ should allow log on constructor to pass through
  constructor with accessToken
    ✓ should have log method
    ✓ should have error method
    ✓ should have buildJsonPayload method
    ✓ should have sendJsonPayload method
    ✓ should have accessToken in options
  constructor with options
    ✓ should have log method
    ✓ should have error method
    ✓ should have accessToken in options
    ✓ should set environment based on default
  constructor with more options
    ✓ should have log method
    ✓ should have error method
    ✓ should have accessToken in options
    ✓ should set environment based on options
    ✓ should set configured options
  configure with updated options
    ✓ should set configured options
  log info
    ✓ should send message when called with only null argument
    ✓ should send message when called with no arguments
  log message with unordered options
    ✓ should work with custom, request, callback, message
  log message with old option ordering
    ✓ should work
    ✓ should work with callback
    ✓ should work with request
    ✓ should work with request and callback
    ✓ should work with request and custom
    ✓ should work with request and custom and callback
  log error with unordered options
    ✓ should work with custom, request, callback, message
  log error with old option ordering
    ✓ should work
    ✓ should work with callback
    ✓ should work with request
    ✓ should work with request and callback
    ✓ should work with request and custom
    ✓ should work with request and custom and callback
  captureUncaught enabled in constructor
    ✓ should log
  captureUnhandledRejections enabled in constructor
    ✓ should log
  captureUncaught enabled in constructor disabled in configure
    ✓ should not log
  captureUnhandledRejections enabled in constructor disabled in configure
    ✓ should not log
  captureUncaught enabled in constructor disabled in configure disabled in constructor
    ✓ should not log
  captureUnhandledRejections enabled in constructor disabled in configure disabled in constructor
    ✓ should not log
  captureUncaught enabled in constructor disabled in configure disabled in constructor enabled in configure
    ✓ should log
  captureUnhandledRejections enabled in constructor disabled in configure disabled in constructor enabled in configure
    ✓ should log

  ♢ transforms

  baseData options defaults item empty
    ✓ should have a timestamp
    ✓ should have an error level
    ✓ should have some defaults
  baseData options defaults item with values
    ✓ should have a critical level
    ✓ should have the defaults overriden by the item
    ✓ should have data from custom
  baseData options with values item empty
    ✓ should have a timestamp
    ✓ should have an error level
    ✓ should have data from options and defaults
  baseData options with values item with values
    ✓ should have a critical level
    ✓ should have the defaults overriden by the item
    ✓ should have data from custom
  addBody options anything item with stackInfo
    ✓ should not error
    ✓ should set the trace_chain
    ✓ should not set a message
  addBody options anything item with no stackInfo
    ✓ should not error
    ✓ should not set the trace_chain
    ✓ should set a message
  addMessageData options anything item no message
    ✓ should not error
    ✓ should add an empty body
  addMessageData options anything item with a message
    ✓ should not error
    ✓ should add a body with the message
  handleItemWithError options anything item no error
    ✓ should not error
    ✓ should not change the item
  handleItemWithError options anything item with a nested error
    ✓ should not error
    ✓ should have the right data in the trace_chain
  handleItemWithError options anything item with a normal error
    ✓ should not error
    ✓ should add some data to the trace_chain
  handleItemWithError options anything item with a simple error
    ✓ should not error
    ✓ should add some data to the trace_chain
  handleItemWithError nodeSourceMaps
    ✓ should map the stack
  addRequestData options without custom addRequestData method without scrub fields item without a request
    ✓ should not error
    ✓ should not change the item
  addRequestData options without custom addRequestData method without scrub fields item with an empty request object
    ✓ should not error
    ✓ should not change request object
  addRequestData options without custom addRequestData method without scrub fields item with a request
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should set a person based on request user
    ✓ should set some fields based on request data
  addRequestData options without custom addRequestData method without scrub fields item with a request like from hapi
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should set a person based on request user
    ✓ should set some fields based on request data
  addRequestData options without custom addRequestData method without scrub fields item with a request with an array body
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should set a person based on request user
    ✓ should set some fields based on request data
  addRequestData options without custom addRequestData method with scrub fields item with a request
    ✓ should not error
    ✓ should have a request object inside data
  addRequestData options with custom addRequestData with scrub fields item with a request
    ✓ should not error
    ✓ should do what the function does
  scrubPayload options without scrub fields item
    ✓ should not error
    ✓ should not scrub okay keys
    ✓ should scrub key/value based on defaults
  scrubPayload options with scrub fields item with a request
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should scrub based on the options
  scrubPayload options with scrub fields item with a json request body
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should scrub based on the options
  scrubPayload options with scrub fields item with a bad json request body
    ✓ should not error
    ✓ should have a request object inside data
    ✓ should delete the body and add a diagnostic error

  ♢ transport

  post with rate limiting
    ✓ should transmit non-rate limited requests
    ✓ should drop rate limited requests and set timeout
  post base data with no payload
    ✓ should have an error
  post base data with a payload and no error
    ✓ should not error
    ✓ should have the right response data
  post base data with a payload and an error in the response
    ✓ should error
    ✓ should have the message somewhere
    ✓ should not have a response
  post base data with a payload and an error during sending
    ✓ should error
    ✓ should have the message somewhere
    ✓ should not have a response
 ✓ OK » 129 honored (2.537s)


Running "test-browser" task

Running "karma:api" (karma) task
⚠ 「wdm」: Hash: d4e94cf661365475ea55
Version: webpack 4.43.0
Time: 81ms
Built at: 05/20/2020 1:36:46 PM

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
ℹ 「wdm」: Compiled with warnings.
ℹ 「wdm」: Compiling...
⚠ 「wdm」: Hash: a1767448bbf7693c8edc
Version: webpack 4.43.0
Time: 4587ms
Built at: 05/20/2020 1:36:50 PM
           Asset     Size  Chunks             Chunk Names
test/api.test.js  229 KiB       0  [emitted]  test/api.test
Entrypoint test/api.test = test/api.test.js
[0] ./src/utility.js 79.3 KiB {0} [built]
[1] ./test/api.test.js 4.1 KiB {0} [built]
[2] ./src/api.js 6.73 KiB {0} [built]
[3] ./src/merge.js 7.69 KiB {0} [built]
[4] ./vendor/JSON-js/json3.js 24.5 KiB {0} [built]
[5] ./src/apiUtility.js 11 KiB {0} [built]
[6] ./src/truncation.js 12.6 KiB {0} [built]

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
ℹ 「wdm」: Compiled with warnings.
20 05 2020 13:36:50.928:INFO [karma-server]: Karma v5.0.4 server started at http://0.0.0.0:9876/
20 05 2020 13:36:50.929:INFO [launcher]: Launching browsers ChromeNoSandbox with concurrency unlimited
20 05 2020 13:36:50.940:INFO [launcher]: Starting browser ChromeHeadless
20 05 2020 13:36:52.171:INFO [Chrome Headless 81.0.4044.138 (Mac OS 10.15.4)]: Connected on socket 5Fko4fmXGrJm7FgzAAAA with id 7746253
Chrome Headless 81.0.4044.138 (Mac OS 10.15.4): Executed 4 of 4 SUCCESS (0.053 secs / 0.028 secs)
TOTAL: 4 SUCCESS
[1]    14863 segmentation fault  npm run test
➜  rollbar.js git:(master)

@daxfrost
Copy link
Author

Hi @waltjones, were you able to test if this issue happens for you? I'd really like to get my local build working even on the master branch running npm run test_ci - I'm happy to do anything you suggest.

@waltjones
Copy link
Contributor

@daxfrost I've tried again with fresh node_modules, and tests all run fine. Also, there are other people currently working in rollbar.js and theirs (and the build on travis) are working fine.

I'm wondering what OS you're on, and maybe we can capture more information about the seg fault.

@msaarmets
Copy link

Hi! Is there any news on the issues mentioned here?

I'm currently trying to use rollbar 2.26.1 in an Expo app and setting the captureUnhandledRejections to true causes the app to crash with an error "TypeError: t.addEventListener is not a function. (In 't.addEventListener("unhandledrejection", n)', 't.addEventListener' is undefined)"

@waltjones
Copy link
Contributor

Hi @msaarmets , this is handled in rollbar/rollbar-react-native#171 and will release soon.

People asked to use the same import for both native and web targets of the same app. This solution provides that.

@waltjones
Copy link
Contributor

Closing in favor of rollbar/rollbar-react-native#171

@waltjones waltjones closed this Apr 27, 2023
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.

3 participants