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

Release v7.11.0 #1484

Merged
merged 41 commits into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8928145
deps(react-native): Update bugsnag-cocoa to v6.10.1
nickdowell Jul 7, 2021
548a443
feat: Ensure server plugins honour autoDetectErrors option
bengourley Jul 7, 2021
19fd340
test: Improve/fix server framework tests
bengourley Jul 7, 2021
7486cbe
chore: Update changelog for release
bengourley Jul 7, 2021
d92f35a
Merge pull request #1463 from bugsnag/nickdowell/bugsnag-cocoa-v6.10.1
nickdowell Jul 8, 2021
1dd3856
Merge branch 'next' into bengourley/plugin-auto-detect-errors-false
bengourley Jul 8, 2021
09462bc
Merge pull request #1464 from bugsnag/bengourley/plugin-auto-detect-e…
bengourley Jul 8, 2021
758badb
Leave breadcrumbs when enabledBreadcrumbTypes=null
imjoehaines Jul 8, 2021
bd6cce3
Add changelog entry
imjoehaines Jul 8, 2021
e6ef283
Don't crash when enabledBreadcrumbTypes is null
imjoehaines Jul 8, 2021
dfa3e5d
Update changelog
imjoehaines Jul 8, 2021
568ae3a
Add electron maze runner test
imjoehaines Jul 9, 2021
341d6c7
Add react native maze runner test
imjoehaines Jul 9, 2021
734bcf3
Add "_isBreadcrumbTypeEnabled" helper to core
imjoehaines Jul 12, 2021
ac0a88f
Use the new helper everywhere
imjoehaines Jul 12, 2021
7ce9059
Merge pull request #1466 from bugsnag/fix-auto-breadcrumbs-when-null
imjoehaines Jul 12, 2021
17e4f34
Merge pull request #1467 from bugsnag/fix-crash-when-enabled-breadcru…
imjoehaines Jul 12, 2021
1e9997e
Merge pull request #1468 from bugsnag/add-breadcrumb-type-helper
imjoehaines Jul 12, 2021
292e347
deps(react-native): Update bugsnag-cocoa to v6.10.2
nickdowell Jul 14, 2021
aae81b2
Merge pull request #1472 from bugsnag/nickdowell/bugsnag-cocoa-v6.10.2
nickdowell Jul 14, 2021
b28a609
dep: bump bugsnag-android to v5.10.0
fractalwrench Jun 29, 2021
76ccdfb
Merge pull request #1452 from bugsnag/android-595
fractalwrench Jul 15, 2021
b783e27
dep: bump bugsnag-android to v5.10.1
fractalwrench Jul 15, 2021
ad5ca5a
ci: bump hermes job timeout for rn0.64
fractalwrench Jul 16, 2021
46448d1
Merge pull request #1474 from bugsnag/android5101
fractalwrench Jul 16, 2021
ce9d8dc
Fix internal type definition for session delegates
imjoehaines Jul 19, 2021
577bc44
Merge pull request #1480 from bugsnag/fix-internal-types
imjoehaines Jul 19, 2021
a59dc1e
Don't catch errors in the Koa requestHandler
imjoehaines Jul 19, 2021
5c19016
Fix Koa "throw non-Error error" test
imjoehaines Jul 19, 2021
72eb7bb
Improve Koa requestHandler unit tests
imjoehaines Jul 19, 2021
8eda704
Don't duplicate attaching metadata
imjoehaines Jul 19, 2021
443682e
Add unit tests for Koa errorHandler
imjoehaines Jul 19, 2021
f846fa9
Ensure the status code is set correctly
imjoehaines Jul 20, 2021
05729f3
Call through to the app error handler if necessary
imjoehaines Jul 20, 2021
9d86988
Ensure other error handlers will run
imjoehaines Jul 20, 2021
e50d840
Don't notify ctx.throw with non-5xx statuses
imjoehaines Jul 20, 2021
1ffe2a8
Bring the v1 error handler in line with v2
imjoehaines Jul 20, 2021
febca91
Add Koa v1 tests with autoDetectErrors=false
imjoehaines Jul 20, 2021
8cdad3d
Add changelog entry
imjoehaines Jul 20, 2021
e75fa7c
Merge pull request #1482 from bugsnag/fix-koa-not-propagating-errors
imjoehaines Jul 21, 2021
a773072
chore: update changelog
djskinner Jul 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .buildkite/node-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ steps:
run: node-maze-runner
use-aliases: true
verbose: true
command: ["-e", "koa.feature", "-e", "koa-1x.feature", "-e", "webpack.feature"]
command: ["-e", "koa.feature", "-e", "koa-1x.feature", "-e", "koa_disabled.feature", "-e", "koa-1x_disabled.feature", "-e", "webpack.feature"]
env:
NODE_VERSION: "4"

Expand All @@ -37,7 +37,7 @@ steps:
run: node-maze-runner
use-aliases: true
verbose: true
command: ["-e", "koa.feature", "-e", "koa-1x.feature"]
command: ["-e", "koa.feature", "-e", "koa-1x.feature", "-e", "koa_disabled.feature", "-e", "koa-1x_disabled.feature"]
env:
NODE_VERSION: "6"

Expand Down
2 changes: 1 addition & 1 deletion .buildkite/react-native-cli-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ steps:

- label: ':ios: Init and build RN 0.64 ipa (Hermes)'
key: 'rn-0-64-hermes-ipa'
timeout_in_minutes: 30
timeout_in_minutes: 60
agents:
queue: 'opensource-mac-cocoa-11'
env:
Expand Down
72 changes: 72 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,77 @@
# Changelog

## 7.11.0 (2021-07-26)

### Added

- Server framework plugins now honour the `autoDetectErrors` configuration option [#1464](https://github.com/bugsnag/bugsnag-js/pull/1464)

### Changed

- (react-native): Update bugsnag-cocoa to v6.10.2
- Fix ThreadSanitizer data race warning in `BSGAppHangDetector`. [bugsnag-cocoa#1153](https://github.com/bugsnag/bugsnag-cocoa/pull/1153)
- Remove (duplicated) `user` information from `metaData`. [bugsnag-cocoa#1151](https://github.com/bugsnag/bugsnag-cocoa/pull/1151)
- Fix a potential stack overflow in `+[BugsnagThread allThreadsWithCurrentThreadBacktrace:]`. [bugsnag-cocoa#1148](https://github.com/bugsnag/bugsnag-cocoa/pull/1148)
- Fix `NSNull` handling in `+[BugsnagError errorFromJson:]` and `+[BugsnagStackframe frameFromJson:]`. [bugsnag-cocoa#1143](https://github.com/bugsnag/bugsnag-cocoa/pull/1143)
- Fix a rare crash in `bsg_ksmachgetThreadQueueName`. [bugsnag-cocoa#1147](https://github.com/bugsnag/bugsnag-cocoa/pull/1147)
- (react-native): Update bugsnag-android to v5.10.1
- Prefer `calloc()` to `malloc()` in NDK code
[bugsnag-android#1320](https://github.com/bugsnag/bugsnag-android/pull/1320)
- Ensure correct value always collected for activeScreen
[bugsnag-android#1322](https://github.com/bugsnag/bugsnag-android/pull/1322)
- Capture process name in Event payload
[bugsnag-android#1318](https://github.com/bugsnag/bugsnag-android/pull/1318)
- Avoid unnecessary BroadcastReceiver registration for monitoring device orientation
[bugsnag-android#1303](https://github.com/bugsnag/bugsnag-android/pull/1303)
- Register system callbacks on background thread
[bugsnag-android#1292](https://github.com/bugsnag/bugsnag-android/pull/1292)
- Fix rare NullPointerExceptions from ConnectivityManager
[bugsnag-android#1311](https://github.com/bugsnag/bugsnag-android/pull/1311)
- Respect manual setting of context
[bugsnag-android#1310](https://github.com/bugsnag/bugsnag-android/pull/1310)
- Handle interrupt when shutting down executors
[bugsnag-android#1315](https://github.com/bugsnag/bugsnag-android/pull/1315)
- React Native: allow serializing enabledBreadcrumbTypes as null
[bugsnag-android#1316](https://github.com/bugsnag/bugsnag-android/pull/1316)
- Unity: Properly handle ANRs after multiple calls to autoNotify and autoDetectAnrs
[bugsnag-android#1265](https://github.com/bugsnag/bugsnag-android/pull/1265)
- Cache value of app.backgroundWorkRestricted
[bugsnag-android#1275](https://github.com/bugsnag/bugsnag-android/pull/1275)
- Optimize execution of callbacks
[bugsnag-android#1276](https://github.com/bugsnag/bugsnag-android/pull/1276)
- Optimize implementation of internal state change observers
[bugsnag-android#1274](https://github.com/bugsnag/bugsnag-android/pull/1274)
- Optimize metadata implementation by reducing type casts
[bugsnag-android#1277](https://github.com/bugsnag/bugsnag-android/pull/1277)
- Trim stacktraces to <200 frames before attempting to construct POJOs
[bugsnag-android#1281](https://github.com/bugsnag/bugsnag-android/pull/1281)
- Use direct field access when adding breadcrumbs and state updates
[bugsnag-android#1279](https://github.com/bugsnag/bugsnag-android/pull/1279)
- Avoid using regex to validate api key
[bugsnag-android#1282](https://github.com/bugsnag/bugsnag-android/pull/1282)
- Discard unwanted automatic data earlier where possible
[bugsnag-android#1280](https://github.com/bugsnag/bugsnag-android/pull/1280)
- Enable ANR handling on immediately if started from the main thread
[bugsnag-android#1283](https://github.com/bugsnag/bugsnag-android/pull/1283)
- Include `app.binaryArch` in all events
[bugsnag-android#1287](https://github.com/bugsnag/bugsnag-android/pull/1287)
- Cache results from PackageManager
[bugsnag-android#1288](https://github.com/bugsnag/bugsnag-android/pull/1288)
- Use ring buffer to store breadcrumbs
[bugsnag-android#1286](https://github.com/bugsnag/bugsnag-android/pull/1286)
- Avoid expensive set construction in Config constructor
[bugsnag-android#1289](https://github.com/bugsnag/bugsnag-android/pull/1289)
- Replace calls to String.format() with concatenation
[bugsnag-android#1293](https://github.com/bugsnag/bugsnag-android/pull/1293)
- Optimize capture of thread traces
[bugsnag-android#1300](https://github.com/bugsnag/bugsnag-android/pull/1300)

### Fixed

- Breadcrumbs will now be left when `enabledBreadcrumbTypes` is `null` [#1466](https://github.com/bugsnag/bugsnag-js/pull/1466)
- Avoid crash when `enabledBreadcrumbTypes` is `null` [#1467](https://github.com/bugsnag/bugsnag-js/pull/1467)
- (plugin-koa): Fix the Koa plugin suppressing other error handlers [#1482](https://github.com/bugsnag/bugsnag-js/pull/1482)

## 7.10.5 (2021-07-05)

### Fixed
Expand Down
8 changes: 5 additions & 3 deletions packages/core/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ export default class ClientWithInternals<T extends Config = Config> extends Clie
_pausedSession: Session | null

_sessionDelegate: {
startSession: (client: ClientWithInternals, session: Session) => any
pauseSession: () => void
resumeSession: () => void
startSession: (client: ClientWithInternals, session: Session) => ClientWithInternals
pauseSession: (client: ClientWithInternals) => void
resumeSession: (client: ClientWithInternals) => ClientWithInternals
}

_addOnSessionPayload: (cb: (sessionPayload: Session) => void) => void
Expand All @@ -72,4 +72,6 @@ export default class ClientWithInternals<T extends Config = Config> extends Clie
}

_loadPlugin(plugin: Plugin): void

_isBreadcrumbTypeEnabled(type: string): boolean
}
8 changes: 7 additions & 1 deletion packages/core/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ class Client {
}
}

_isBreadcrumbTypeEnabled (type) {
const types = this._config.enabledBreadcrumbTypes

return types === null || includes(types, type)
}

notify (maybeError, onError, cb = noop) {
const event = Event.create(maybeError, true, undefined, 'notify()', this._depth + 1, this._logger)
this._notify(event, onError, cb)
Expand Down Expand Up @@ -296,7 +302,7 @@ class Client {
return cb(null, event)
}

if (includes(this._config.enabledBreadcrumbTypes, 'error')) {
if (this._isBreadcrumbTypeEnabled('error')) {
// only leave a crumb for the error if actually got sent
Client.prototype.leaveBreadcrumb.call(this, event.errors[0].errorClass, {
errorClass: event.errors[0].errorClass,
Expand Down
93 changes: 73 additions & 20 deletions packages/core/test/client.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import Client from '../client'
import Event from '../event'
import Session from '../session'
import breadcrumbTypes from '../lib/breadcrumb-types'
import { BreadcrumbType } from '../types/common'

const noop = () => {}
const id = <T>(a: T) => a

describe('@bugsnag/core/client', () => {
describe('constructor', () => {
Expand Down Expand Up @@ -396,6 +401,19 @@ describe('@bugsnag/core/client', () => {
expect(payloads[0].events[0].breadcrumbs.length).toBe(0)
})

it('leaves a breadcrumb of the error when enabledBreadcrumbTypes=null', () => {
const payloads: any[] = []
const client = new Client({ apiKey: 'API_KEY_YEAH', enabledBreadcrumbTypes: null })
client._setDelivery(client => ({ sendEvent: (payload) => payloads.push(payload), sendSession: () => {} }))
client.notify(new Error('foobar'))
expect(client._breadcrumbs).toHaveLength(1)
expect(client._breadcrumbs[0].type).toBe('error')
expect(client._breadcrumbs[0].message).toBe('Error')
expect(client._breadcrumbs[0].metadata.stacktrace).toBe(undefined)
// the error shouldn't appear as a breadcrumb for itself
expect(payloads[0].events[0].breadcrumbs).toHaveLength(0)
})

it('doesn’t modify global client.metadata when using addMetadata() method', () => {
const client = new Client({ apiKey: 'API_KEY_YEAH' })
client.addMetadata('foo', 'bar', [1, 2, 3])
Expand Down Expand Up @@ -614,20 +632,55 @@ describe('@bugsnag/core/client', () => {
})
})

describe('_isBreadcrumbTypeEnabled()', () => {
it.each(breadcrumbTypes)('returns true for "%s" when enabledBreadcrumbTypes is not configured', (type) => {
const client = new Client({ apiKey: 'API_KEY_YEAH' })

expect(client._isBreadcrumbTypeEnabled(type)).toBe(true)
})

it.each(breadcrumbTypes)('returns true for "%s" when enabledBreadcrumbTypes=null', (type) => {
const client = new Client({ apiKey: 'API_KEY_YEAH', enabledBreadcrumbTypes: null })

expect(client._isBreadcrumbTypeEnabled(type)).toBe(true)
})

it.each(breadcrumbTypes)('returns false for "%s" when enabledBreadcrumbTypes=[]', (type) => {
const client = new Client({ apiKey: 'API_KEY_YEAH', enabledBreadcrumbTypes: [] })

expect(client._isBreadcrumbTypeEnabled(type)).toBe(false)
})

it.each(breadcrumbTypes)('returns true for "%s" when enabledBreadcrumbTypes only contains it', (type) => {
const client = new Client({ apiKey: 'API_KEY_YEAH', enabledBreadcrumbTypes: [type as BreadcrumbType] })

expect(client._isBreadcrumbTypeEnabled(type)).toBe(true)
})

it.each(breadcrumbTypes)('returns false for "%s" when enabledBreadcrumbTypes does not contain it', (type) => {
const enabledBreadcrumbTypes = breadcrumbTypes.filter(enabledType => enabledType !== type)

const client = new Client({
apiKey: 'API_KEY_YEAH',
enabledBreadcrumbTypes: enabledBreadcrumbTypes as BreadcrumbType[]
})

expect(client._isBreadcrumbTypeEnabled(type)).toBe(false)
})
})

describe('startSession()', () => {
it('calls the provided session delegate and return delegate’s return value', () => {
const client = new Client({ apiKey: 'API_KEY' })
let ret
client._sessionDelegate = {
startSession: c => {
expect(c).toBe(client)
ret = {}
return ret
return c
},
pauseSession: () => {},
resumeSession: () => {}
pauseSession: noop,
resumeSession: id
}
expect(client.startSession()).toBe(ret)
expect(client.startSession()).toBe(client)
})

it('tracks error counts using the session delegate and sends them in error payloads', (done) => {
Expand All @@ -638,8 +691,8 @@ describe('@bugsnag/core/client', () => {
client._session = new Session()
return client
},
pauseSession: () => {},
resumeSession: () => {}
pauseSession: noop,
resumeSession: id
}
client._setDelivery(client => ({
sendSession: () => {},
Expand Down Expand Up @@ -668,9 +721,9 @@ describe('@bugsnag/core/client', () => {
it('does not start the session if onSession returns false', () => {
const client = new Client({ apiKey: 'API_KEY', onSession: () => false })
const sessionDelegate = {
startSession: () => {},
pauseSession: () => {},
resumeSession: () => {}
startSession: id,
pauseSession: noop,
resumeSession: id
}
client._sessionDelegate = sessionDelegate

Expand All @@ -688,9 +741,9 @@ describe('@bugsnag/core/client', () => {
}
})
const sessionDelegate = {
startSession: () => {},
pauseSession: () => {},
resumeSession: () => {}
startSession: id,
pauseSession: noop,
resumeSession: id
}
client._sessionDelegate = sessionDelegate

Expand All @@ -707,9 +760,9 @@ describe('@bugsnag/core/client', () => {
c._setDelivery(client => ({ sendEvent: (p, cb) => cb(null), sendSession: (s: any, cb: any) => cb(null) }))
c._logger = console
const sessionDelegate = {
startSession: () => {},
pauseSession: () => {},
resumeSession: () => {}
startSession: id,
pauseSession: noop,
resumeSession: id
}
c._sessionDelegate = sessionDelegate
const eSpy = jest.fn()
Expand Down Expand Up @@ -787,9 +840,9 @@ describe('@bugsnag/core/client', () => {
it('forwards on calls to the session delegate', () => {
const client = new Client({ apiKey: 'API_KEY' })
const sessionDelegate = {
startSession: () => {},
pauseSession: () => {},
resumeSession: () => {}
startSession: id,
pauseSession: noop,
resumeSession: id
}
client._sessionDelegate = sessionDelegate

Expand Down
2 changes: 1 addition & 1 deletion packages/electron/src/client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module.exports = (opts) => {
bugsnag.markLaunchComplete = markLaunchComplete

bugsnag._logger.debug('Loaded! In main process.')
if (bugsnag._config.enabledBreadcrumbTypes && bugsnag._config.enabledBreadcrumbTypes.includes('state')) {
if (bugsnag._isBreadcrumbTypeEnabled('state')) {
bugsnag.leaveBreadcrumb('Bugsnag loaded', {}, 'state')
}

Expand Down
4 changes: 3 additions & 1 deletion packages/electron/src/client/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ module.exports = (rendererOpts) => {

// automatic error breadcrumbs will always be duplicates if created in renderers
// because both the renderers and main process create them for the same Event
opts.enabledBreadcrumbTypes = opts.enabledBreadcrumbTypes.filter(type => type !== 'error')
if (opts.enabledBreadcrumbTypes !== null) {
opts.enabledBreadcrumbTypes = opts.enabledBreadcrumbTypes.filter(type => type !== 'error')
}

const bugsnag = new Client(opts, schema, internalPlugins, require('../id'))

Expand Down
24 changes: 18 additions & 6 deletions packages/in-flight/test/in-flight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import BugsnagInFlightJustForTypescript from '../types/bugsnag-in-flight'

let bugsnagInFlight: BugsnagInFlightJustForTypescript
jest.isolateModules(() => { bugsnagInFlight = require('../src/in-flight') })
const noop = () => {}
const id = <T>(a: T) => a

describe('@bugsnag/in-flight', () => {
it('tracks in-flight events', () => {
Expand Down Expand Up @@ -50,6 +52,8 @@ describe('@bugsnag/in-flight', () => {
client._sessionDelegate = {
startSession: jest.fn(function (client, session) {
client._delivery.sendSession(session, callback)

return client
}),
pauseSession: jest.fn(),
resumeSession: jest.fn()
Expand Down Expand Up @@ -89,6 +93,8 @@ describe('@bugsnag/in-flight', () => {
client._sessionDelegate = {
startSession: jest.fn(function (client, session) {
client._delivery.sendSession(session, sessionCallback)

return client
}),
pauseSession: jest.fn(),
resumeSession: jest.fn()
Expand Down Expand Up @@ -135,9 +141,11 @@ describe('@bugsnag/in-flight', () => {
client._sessionDelegate = {
startSession (client, session) {
client._delivery.sendSession(session, () => {})

return client
},
pauseSession: () => {},
resumeSession: () => {}
pauseSession: noop,
resumeSession: id
}

client._setDelivery(() => ({
Expand Down Expand Up @@ -177,9 +185,11 @@ describe('@bugsnag/in-flight', () => {
client._sessionDelegate = {
startSession: (client, session) => {
client._delivery.sendSession(session, () => {})

return client
},
pauseSession: () => {},
resumeSession: () => {}
pauseSession: noop,
resumeSession: id
}

client._setDelivery(() => ({
Expand Down Expand Up @@ -225,9 +235,11 @@ describe('@bugsnag/in-flight', () => {
client._sessionDelegate = {
startSession (client, session) {
client._delivery.sendSession(session, () => {})

return client
},
pauseSession: () => {},
resumeSession: () => {}
pauseSession: noop,
resumeSession: id
}

client._setDelivery(() => ({
Expand Down
Loading