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 v49.0.2 #159

Merged
merged 13 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading