Skip to content

Commit

Permalink
Merge pull request #159 from bugsnag/release/v49.0.2
Browse files Browse the repository at this point in the history
Release v49.0.2
  • Loading branch information
gingerbenw authored Dec 7, 2023
2 parents 502a2d2 + 532ef82 commit 43ae400
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ steps:
- --farm=bs
- --device=IOS_15
- --a11y-locator
- --appium-version=1.21.0
- --retry=2
- --order=random
concurrency: 5
Expand All @@ -111,7 +110,6 @@ steps:
- --farm=bs
- --device=IOS_13
- --a11y-locator
- --appium-version=1.17.0
- --retry=2
- --order=random
concurrency: 5
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## v49.0.2 (2023-12-07)

### Added

- (delivery-expo) Explicitly mark failed payloads >1MB as not retryable [#65](https://github.com/bugsnag/bugsnag-expo/pull/65)

### Fixed

- (plugin-expo-eas-sourcemaps) Ensure EAS sourcemap config plugin is idempotent [#156](https://github.com/bugsnag/bugsnag-expo/pull/156)

## v49.0.1 (2023-08-03)

### Fixed
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
BUILDKITE_BUILD_CREATOR:
BUILDKITE_BUILD_NUMBER:
BUILDKITE_BUILD_URL:
BUILDKITE_JOB_ID:
BUILDKITE_LABEL:
BUILDKITE_MESSAGE:
BUILDKITE_PIPELINE_NAME:
Expand Down
9 changes: 8 additions & 1 deletion packages/delivery-expo/delivery.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@ module.exports = (client, fetch = global.fetch) => {
}
client._logger.info(`Sending event ${event.events[0].errors[0].errorClass}: ${event.events[0].errors[0].errorMessage}`)
send(url, opts, err => {
if (err) return onerror(err, { url, opts }, 'event', cb)
if (err) {
// do not retry oversized payloads regardless of status code
if (body.length > 10e5) {
client._logger.warn(`Discarding over-sized event (${body.length / 10e5} MB) after failed delivery`)
err.isRetryable = false
}
return onerror(err, { url, opts }, 'event', cb)
}
cb(null)
})
} catch (e) {
Expand Down
37 changes: 37 additions & 0 deletions packages/delivery-expo/test/delivery.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,43 @@ describe('delivery: expo', () => {
})
})

it('does not attempt to re-send oversized payloads', done => {
// A 401 is considered retryable but this will be overridden by the payload size check
const { requests, server } = mockServer(401)
server.listen(err => {
expect(err).toBeUndefined()

const lotsOfEvents = []
while (JSON.stringify(lotsOfEvents).length < 10e5) {
lotsOfEvents.push({ errors: [{ errorClass: 'Error', errorMessage: 'long repetitive string'.repeat(1000) }] })
}
const payload = {
events: lotsOfEvents
}

const config = {
apiKey: 'aaaaaaaa',
endpoints: { notify: `http://0.0.0.0:${server.address().port}/notify/` },
redactedKeys: []
}

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

delivery({ _config: config, _logger: logger }, fetch).sendEvent(payload, (err) => {
expect(logger.warn).toHaveBeenCalledWith('Discarding over-sized event (1.014603 MB) after failed delivery')
expect(enqueueSpy).not.toHaveBeenCalled()
expect(err).toBeTruthy()
expect(requests.length).toBe(0)
server.close()
done()
})
})
})

it('handles errors gracefully for sessions (ECONNREFUSED)', done => {
const payload = {
events: [{ errors: [{ errorClass: 'Error', errorMessage: 'foo is not a function' }] }]
Expand Down
23 changes: 15 additions & 8 deletions packages/plugin-expo-eas-sourcemaps/src/ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,24 @@ function withIosPlugin (config, onPremConfig) {

const additionalExports = '"export EXTRA_PACKAGER_ARGS=\\"--sourcemap-output $TMPDIR/$(md5 -qs \\"$CONFIGURATION_BUILD_DIR\\")-main.jsbundle.map\\"\\n'

const modifiedScript = additionalExports + initialScript.substr(1)

bundleReactNativePhase.shellScript = modifiedScript
if (initialScript.indexOf(additionalExports) < 0) {
const modifiedScript = additionalExports + initialScript.substr(1)
bundleReactNativePhase.shellScript = modifiedScript
}

// 03. Configure the new build phase
const shellScript = 'SOURCE_MAP="$TMPDIR/$(md5 -qs "$CONFIGURATION_BUILD_DIR")-main.jsbundle.map" ../node_modules/@bugsnag/plugin-expo-eas-sourcemaps/lib/bugsnag-expo-xcode.sh'
const uploadBuildPhaseComment = 'Upload source maps to Bugsnag'

const uploadBuildPhase = xcodeProject.pbxItemByComment(uploadBuildPhaseComment, buildPhaseName)

xcodeProject.addBuildPhase([], buildPhaseName, 'Upload source maps to Bugsnag', null, {
shellPath: '/bin/sh',
shellScript: shellScript
})
if (!uploadBuildPhase) {
const shellScript = 'SOURCE_MAP="$TMPDIR/$(md5 -qs "$CONFIGURATION_BUILD_DIR")-main.jsbundle.map" ../node_modules/@bugsnag/plugin-expo-eas-sourcemaps/lib/bugsnag-expo-xcode.sh'

xcodeProject.addBuildPhase([], buildPhaseName, uploadBuildPhaseComment, null, {
shellPath: '/bin/sh',
shellScript: shellScript
})
}

return config
})
Expand Down

0 comments on commit 43ae400

Please sign in to comment.