Skip to content

Commit f21fab8

Browse files
author
Dan Skinner
committed
Merge branch 'next' into plat-6094
* next: chore(plugin-restify): send body in event.request dep: bump bugsnag-android dependency to v5.20.0 chore(examples): add missing Dockerfile to angular example
2 parents 73d94e5 + 07d5963 commit f21fab8

File tree

8 files changed

+45
-8
lines changed

8 files changed

+45
-8
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
## Unreleased
44

5+
### Changed
6+
7+
- (react-native) Update bugsnag-android to v5.20.0
8+
- The number of threads reported can now be limited using `Configuration.setMaxReportedThreads` (defaulting to 200)
9+
[bugsnag-android#1607](https://github.com/bugsnag/bugsnag-android/pull/1607)
10+
- Improved the performance and stability of the NDK and ANR plugins by caching JNI references on start
11+
[bugsnag-android#1596](https://github.com/bugsnag/bugsnag-android/pull/1596)
12+
[bugsnag-android#1601](https://github.com/bugsnag/bugsnag-android/pull/1601)
513

614
### Fixed
715

examples/ts/angular/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM node:8
2+
3+
WORKDIR /usr/src/app
4+
5+
COPY package* /usr/src/app/
6+
RUN npm install
7+
8+
COPY . /usr/src/app/
9+
CMD npm run serve -- --host 0.0.0.0

examples/ts/angular/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ docker build -t bugsnag-js-example-angular . && \
2727
docker run -p 4200:4200 -it bugsnag-js-example-angular
2828
```
2929

30-
__Note__: remember to replace `YOUR_API_KEY` in `src/lib/bugsnag.js` with your own!
30+
__Note__: remember to replace `YOUR_API_KEY` in `src/app/app.module.ts` with your own!
3131

3232
### Without docker
3333
Ensure you have a version of Node.js >=4 on your machine.

packages/plugin-restify/src/restify.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ module.exports = {
2424
req.bugsnag = requestClient
2525

2626
// extract request info and pass it to the relevant bugsnag properties
27-
const { request, metadata } = getRequestAndMetadataFromReq(req)
28-
requestClient.addMetadata('request', metadata)
2927
requestClient.addOnError((event) => {
28+
const { request, metadata } = getRequestAndMetadataFromReq(req)
3029
event.request = { ...event.request, ...request }
30+
requestClient.addMetadata('request', metadata)
3131
}, true)
3232

3333
if (!client._config.autoDetectErrors) return next()
@@ -77,15 +77,16 @@ module.exports = {
7777
}
7878

7979
const getRequestAndMetadataFromReq = req => {
80-
const requestInfo = extractRequestInfo(req)
80+
const { body, ...requestInfo } = extractRequestInfo(req)
8181
return {
8282
metadata: requestInfo,
8383
request: {
84+
body,
8485
clientIp: requestInfo.clientIp,
8586
headers: requestInfo.headers,
8687
httpMethod: requestInfo.httpMethod,
8788
url: requestInfo.url,
88-
referer: requestInfo.referer
89+
referer: requestInfo.referer // Not part of the notifier spec for request but leaving for backwards compatibility
8990
}
9091
}
9192
}

packages/react-native/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ android {
3939
}
4040

4141
dependencies {
42-
api "com.bugsnag:bugsnag-android:5.19.2"
43-
api "com.bugsnag:bugsnag-plugin-react-native:5.19.2"
42+
api "com.bugsnag:bugsnag-android:5.20.0"
43+
api "com.bugsnag:bugsnag-plugin-react-native:5.20.0"
4444
implementation 'com.facebook.react:react-native:+'
4545

4646
testImplementation "junit:junit:4.12"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version
2-
5.19.2
2+
5.20.0

test/node/features/fixtures/restify/scenarios/app.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ var server = restify.createServer()
1818

1919
server.pre(middleware.requestHandler)
2020

21+
server.use(restify.plugins.bodyParser());
22+
2123
// If the server hasn't started sending something within 2 seconds
2224
// it probably won't. So end the request and hurry the failing test
2325
// along.
@@ -79,6 +81,10 @@ server.get('/handled', function (req, res, next) {
7981
res.end('OK')
8082
})
8183

84+
server.post('/bodytest', function (req, res, next) {
85+
throw new Error('request body')
86+
})
87+
8288
server.on('restifyError', middleware.errorHandler)
8389

8490
server.listen(80)

test/node/features/restify.feature

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,16 @@ Scenario: a handled error passed to req.bugsnag.notify()
8989
And the event "request.url" equals "http://restify/handled"
9090
And the event "request.httpMethod" equals "GET"
9191
And the event "request.clientIp" is not null
92+
93+
Scenario: adding body to request metadata
94+
When I POST the data "data=in_request_body" to the URL "http://restify/bodytest"
95+
And I wait to receive an error
96+
Then the error is valid for the error reporting API version "4" for the "Bugsnag Node" notifier
97+
And the event "unhandled" is true
98+
And the event "severity" equals "error"
99+
And the exception "errorClass" equals "Error"
100+
And the exception "message" equals "request body"
101+
And the exception "type" equals "nodejs"
102+
And the "file" of stack frame 0 equals "scenarios/app.js"
103+
And the event "request.body.data" equals "in_request_body"
104+
And the event "request.httpMethod" equals "POST"

0 commit comments

Comments
 (0)