Skip to content

Commit

Permalink
Merge pull request #1601 from bugsnag/release/v7.14.1
Browse files Browse the repository at this point in the history
Release v7.14.1
  • Loading branch information
imjoehaines committed Nov 29, 2021
2 parents 18223eb + 72cc1f1 commit ad53a0d
Show file tree
Hide file tree
Showing 17 changed files with 237 additions and 116 deletions.
14 changes: 14 additions & 0 deletions .buildkite/browser-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,20 @@ steps:
concurrency: 5
concurrency_group: 'browserstack'

- label: ':safari: v15 Browser tests'
depends_on: "browser-maze-runner-image"
timeout_in_minutes: 10
plugins:
docker-compose#v3.7.0:
run: browser-maze-runner
use-aliases: true
verbose: true
command:
- --farm=bs
- --browser=safari_15
concurrency: 5
concurrency_group: 'browserstack'

- label: ':iphone: iOS 10.3 Browser tests'
depends_on: "browser-maze-runner-image"
timeout_in_minutes: 20
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 7.14.1 (2021-11-29)

### Fixed

- (plugin-network-breadcrumbs): Fix a crash when request URL is not a string [#1598](https://github.com/bugsnag/bugsnag-js/pull/1598)
- (in-flight): Fix Typescript definition exporting a type instead of a value [skirsten](https://github.com/skirsten) [#1587](https://github.com/bugsnag/bugsnag-js/pull/1587)
- (plugin-electron-net-breadcrumbs): Don't leave breadcrumbs for requests to the minidumps endpoint [#1597](https://github.com/bugsnag/bugsnag-js/pull/1597)
- Add a `default` export to plugins that were missing one [#1599](https://github.com/bugsnag/bugsnag-js/pull/1599)

## 7.14.0 (2021-11-17)

This release adds support for reporting native crashes to `@bugsnag/electron`.
Expand Down
64 changes: 64 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,17 @@ services:
- BUILDKITE_BUILD_NUMBER
environment:
BUILDKITE:
BUILDKITE_BRANCH:
BUILDKITE_BUILD_CREATOR:
BUILDKITE_BUILD_NUMBER:
BUILDKITE_BUILD_URL:
BUILDKITE_LABEL:
BUILDKITE_MESSAGE:
BUILDKITE_PIPELINE_NAME:
BUILDKITE_REPO:
BUILDKITE_RETRY_COUNT:
BUILDKITE_STEP_KEY:
MAZE_BUGSNAG_API_KEY:
DEBUG:
BROWSER_STACK_USERNAME:
BROWSER_STACK_ACCESS_KEY:
Expand All @@ -50,6 +60,18 @@ services:
target: node-maze-runner
command: --fail-fast --retry 2
environment:
BUILDKITE:
BUILDKITE_BRANCH:
BUILDKITE_BUILD_CREATOR:
BUILDKITE_BUILD_NUMBER:
BUILDKITE_BUILD_URL:
BUILDKITE_LABEL:
BUILDKITE_MESSAGE:
BUILDKITE_PIPELINE_NAME:
BUILDKITE_REPO:
BUILDKITE_RETRY_COUNT:
BUILDKITE_STEP_KEY:
MAZE_BUGSNAG_API_KEY:
NODE_VERSION: "${NODE_VERSION:-10}"
COMPOSE_PROJECT_NAME: "node${NODE_VERSION:-10}"
NETWORK_NAME: "${BUILDKITE_JOB_ID:-js-maze-runner}"
Expand All @@ -69,7 +91,17 @@ services:
- BUILDKITE_BUILD_NUMBER
environment:
BUILDKITE:
BUILDKITE_BRANCH:
BUILDKITE_BUILD_CREATOR:
BUILDKITE_BUILD_NUMBER:
BUILDKITE_BUILD_URL:
BUILDKITE_LABEL:
BUILDKITE_MESSAGE:
BUILDKITE_PIPELINE_NAME:
BUILDKITE_REPO:
BUILDKITE_RETRY_COUNT:
BUILDKITE_STEP_KEY:
MAZE_BUGSNAG_API_KEY:
DEBUG:
BROWSER_STACK_USERNAME:
BROWSER_STACK_ACCESS_KEY:
Expand Down Expand Up @@ -145,6 +177,18 @@ services:
context: .
dockerfile: dockerfiles/Dockerfile.react-native-cli-tool
environment:
BUILDKITE:
BUILDKITE_BRANCH:
BUILDKITE_BUILD_CREATOR:
BUILDKITE_BUILD_NUMBER:
BUILDKITE_BUILD_URL:
BUILDKITE_LABEL:
BUILDKITE_MESSAGE:
BUILDKITE_PIPELINE_NAME:
BUILDKITE_REPO:
BUILDKITE_RETRY_COUNT:
BUILDKITE_STEP_KEY:
MAZE_BUGSNAG_API_KEY:
DEBUG:
REACT_NATIVE_VERSION:
NETWORK_NAME: "${BUILDKITE_JOB_ID:-react-native-cli-maze-runner}"
Expand Down Expand Up @@ -183,7 +227,17 @@ services:
image: 855461928731.dkr.ecr.us-west-1.amazonaws.com/maze-runner-releases:latest-v6-cli
environment:
BUILDKITE:
BUILDKITE_BRANCH:
BUILDKITE_BUILD_CREATOR:
BUILDKITE_BUILD_NUMBER:
BUILDKITE_BUILD_URL:
BUILDKITE_LABEL:
BUILDKITE_MESSAGE:
BUILDKITE_PIPELINE_NAME:
BUILDKITE_REPO:
BUILDKITE_RETRY_COUNT:
BUILDKITE_STEP_KEY:
MAZE_BUGSNAG_API_KEY:
DEBUG:
BROWSER_STACK_USERNAME:
BROWSER_STACK_ACCESS_KEY:
Expand All @@ -200,7 +254,17 @@ services:
image: 855461928731.dkr.ecr.us-west-1.amazonaws.com/maze-runner-releases:latest-v6-cli
environment:
BUILDKITE:
BUILDKITE_BRANCH:
BUILDKITE_BUILD_CREATOR:
BUILDKITE_BUILD_NUMBER:
BUILDKITE_BUILD_URL:
BUILDKITE_LABEL:
BUILDKITE_MESSAGE:
BUILDKITE_PIPELINE_NAME:
BUILDKITE_REPO:
BUILDKITE_RETRY_COUNT:
BUILDKITE_STEP_KEY:
MAZE_BUGSNAG_API_KEY:
DEBUG:
BROWSER_STACK_USERNAME:
BROWSER_STACK_ACCESS_KEY:
Expand Down
2 changes: 1 addition & 1 deletion packages/in-flight/test/in-flight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Client, { EventDeliveryPayload, SessionDeliveryPayload } from '@bugsnag/c
// 'bugsnagInFlight' variable for this test to compile
import BugsnagInFlightJustForTypescript from '../types/bugsnag-in-flight'

let bugsnagInFlight: BugsnagInFlightJustForTypescript
let bugsnagInFlight: typeof BugsnagInFlightJustForTypescript
jest.isolateModules(() => { bugsnagInFlight = require('../src/in-flight') })
const noop = () => {}
const id = <T>(a: T) => a
Expand Down
4 changes: 3 additions & 1 deletion packages/in-flight/types/bugsnag-in-flight.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ interface BugsnagInFlight {
flush (timeoutMs: number): Promise<void>
}

export default BugsnagInFlight
declare const BugsnagInFlightPlugin: BugsnagInFlight

export default BugsnagInFlightPlugin
3 changes: 3 additions & 0 deletions packages/plugin-aws-lambda/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,6 @@ function isPromise (value) {
}

module.exports = BugsnagPluginAwsLambda

// add a default export for ESM modules without interop
module.exports.default = module.exports
3 changes: 3 additions & 0 deletions packages/plugin-contextualize/contextualize.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ module.exports = {
return contextualize
}
}

// add a default export for ESM modules without interop
module.exports.default = module.exports
4 changes: 3 additions & 1 deletion packages/plugin-electron-net-breadcrumbs/net-breadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ module.exports = net => ({
const method = request._urlLoaderOptions.method

// don't leave breadcrumbs for Bugsnag endpoints
if (ignoredUrls.includes(url)) {
// minidump requests will have an 'api_key' query string parameter, which
// we need to remove here
if (typeof url === 'string' && ignoredUrls.includes(url.replace(/\?.*$/, ''))) {
return request
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ describe('plugin: electron net breadcrumbs', () => {
})

it.each([
'notify', 'sessions', 'minidump'
'notify', 'sessions'
])('does nothing when the request is to the %s endpoint', async (endpointName) => {
currentServer = await startServer(200)

Expand Down Expand Up @@ -224,6 +224,38 @@ describe('plugin: electron net breadcrumbs', () => {
expect(client._breadcrumbs).toHaveLength(0)
})

it.each('does nothing when the request is to the minidumps endpoint', async () => {
currentServer = await startServer(200)

const url = `http://localhost:${currentServer.port}`

const client = makeClient({
config: {
endpoints: {
notify: 'https://example.com/notify',
sessions: 'https://example.com/sessions',
minidumps: url
}
},
schema: {
endpoints: { defaultValue: () => ({}), message: '', validate: () => true }
}
})

const request = net.request(`${url}?api_key=1234567890`)

await new Promise(resolve => {
request.on('response', (response) => {
response.on('data', () => {})
response.on('end', resolve)
})

request.end()
})

expect(client._breadcrumbs).toHaveLength(0)
})

it('does nothing when request breadcrumbs are disabled', async () => {
currentServer = await startServer(200)

Expand Down
3 changes: 3 additions & 0 deletions packages/plugin-intercept/intercept.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ module.exports = {
return intercept
}
}

// add a default export for ESM modules without interop
module.exports.default = module.exports
14 changes: 10 additions & 4 deletions packages/plugin-network-breadcrumbs/network-breadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,16 @@ module.exports = (_ignoredUrls = [], win = window) => {
}

function handleXHRLoad () {
if (this[REQUEST_URL_KEY] === undefined) {
const url = this[REQUEST_URL_KEY]

if (url === undefined) {
client._logger.warn('The request URL is no longer present on this XMLHttpRequest. A breadcrumb cannot be left for this request.')
return
}

if (includes(ignoredUrls, this[REQUEST_URL_KEY].replace(/\?.*$/, ''))) {
// an XMLHttpRequest's URL can be an object as long as its 'toString'
// returns a URL, e.g. a HTMLAnchorElement
if (typeof url === 'string' && includes(ignoredUrls, url.replace(/\?.*$/, ''))) {
// don't leave a network breadcrumb from bugsnag notify calls
return
}
Expand All @@ -82,12 +86,14 @@ module.exports = (_ignoredUrls = [], win = window) => {
}

function handleXHRError () {
if (this[REQUEST_URL_KEY] === undefined) {
const url = this[REQUEST_URL_KEY]

if (url === undefined) {
client._logger.warn('The request URL is no longer present on this XMLHttpRequest. A breadcrumb cannot be left for this request.')
return
}

if (includes(ignoredUrls, this[REQUEST_URL_KEY].replace(/\?.*$/, ''))) {
if (typeof url === 'string' && includes(ignoredUrls, url.replace(/\?.*$/, ''))) {
// don't leave a network breadcrumb from bugsnag notify calls
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class XMLHttpRequest {
this.status = null
}

open (method: string, url: string) {
open (method: string, url: string | { toString: () => any }) {
}

send (fail: boolean, status: number | null = null) {
Expand Down Expand Up @@ -225,6 +225,61 @@ describe('plugin: network breadcrumbs', () => {
)
})

it('should leave a breadcrumb when the request URL is not a string', () => {
const window = { XMLHttpRequest } as unknown as Window & typeof globalThis

const logger = {
debug: jest.fn(),
info: jest.fn(),
warn: jest.fn(),
error: jest.fn()
}

p = plugin([], window)
const client = new Client({ apiKey: 'abcabcabcabcabcabcabc1234567890f', logger, plugins: [p] })

const request = new window.XMLHttpRequest() as unknown as XMLHttpRequest
request.open('GET', { toString: () => 'https://example.com' })
request.send(false, 200)

expect(client._breadcrumbs.length).toBe(1)
expect(client._breadcrumbs[0]).toEqual(expect.objectContaining({
type: 'request',
message: 'XMLHttpRequest succeeded',
metadata: {
status: 200,
request: 'GET https://example.com'
}
}))
})

it('should leave a breadcrumb when the request URL is not a string for a request that errors', () => {
const window = { XMLHttpRequest } as unknown as Window & typeof globalThis

const logger = {
debug: jest.fn(),
info: jest.fn(),
warn: jest.fn(),
error: jest.fn()
}

p = plugin([], window)
const client = new Client({ apiKey: 'abcabcabcabcabcabcabc1234567890f', logger, plugins: [p] })

const request = new window.XMLHttpRequest() as unknown as XMLHttpRequest
request.open('GET', { toString: () => 'https://example.com' })
request.send(true)

expect(client._breadcrumbs.length).toBe(1)
expect(client._breadcrumbs[0]).toEqual(expect.objectContaining({
type: 'request',
message: 'XMLHttpRequest error',
metadata: {
request: 'GET https://example.com'
}
}))
})

it('should leave a breadcrumb when a fetch() resolves', (done) => {
const window = { XMLHttpRequest, fetch } as unknown as Window & typeof globalThis

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ module.exports = class BugsnagPluginReactNativeNavigation {
})
}
}

// add a default export for ESM modules without interop
module.exports.default = module.exports
3 changes: 3 additions & 0 deletions packages/plugin-react-navigation/react-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ class BugsnagPluginReactNavigation {
}

module.exports = BugsnagPluginReactNavigation

// add a default export for ESM modules without interop
module.exports.default = module.exports
3 changes: 3 additions & 0 deletions packages/plugin-vue/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ module.exports = class BugsnagPluginVue {
}
}
}

// add a default export for ESM modules without interop
module.exports.default = module.exports
Loading

0 comments on commit ad53a0d

Please sign in to comment.