Skip to content

Commit c406360

Browse files
committed
feat: node 15 support
Fixes elastic#1840
1 parent e6018a6 commit c406360

9 files changed

+39
-4
lines changed

.ci/.jenkins_nightly_nodejs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
NODEJS_VERSION:
2+
- "15"
23
- "14"
34
- "13"
45
- "12"

.ci/.jenkins_nodejs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
NODEJS_VERSION:
2+
- "15"
23
- "14"
34
- "14.0"
45
- "13"

.ci/.jenkins_rc_nodejs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
NODEJS_VERSION:
2+
- "15"
23
- "14"
34
- "13"
45
- "12"

.ci/.jenkins_tav_nodejs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
NODEJS_VERSION:
2+
- "15"
23
- "14"
34
- "13"
45
- "12"

.npmrc

+8
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
11
package-lock=false
2+
3+
# Workaround unresolvable peerDependencies between express-graphql, graphql,
4+
# and apollo-server-express. npm v7 (included with node v15) makes these
5+
# peerDependencies issues an install error. Until the community catches up
6+
# and resolves peerDependencies issues or this modules tests are setup to
7+
# not have competing deps in "devDependencies", we revert to the pre-v7
8+
# behavior. https://docs.npmjs.com/cli/v7/using-npm/config#legacy-peer-deps
9+
legacy-peer-deps=true

.travis.yml

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ before_script:
4242
- wait-on tcp:9200
4343

4444
node_js:
45+
- '15'
4546
- '14'
4647
- '14.0'
4748
- '13'
@@ -57,6 +58,9 @@ jobs:
5758

5859
include:
5960
# Disable Async Hooks
61+
-
62+
node_js: '15'
63+
env: ELASTIC_APM_ASYNC_HOOKS=false
6064
-
6165
node_js: '14'
6266
env: ELASTIC_APM_ASYNC_HOOKS=false

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"url": "git://github.com/elastic/apm-agent-nodejs.git"
4646
},
4747
"engines": {
48-
"node": "^8.6.0 || 10 || 12 || 13 || 14"
48+
"node": "^8.6.0 || 10 || 12 || 13 || 14 || 15"
4949
},
5050
"keywords": [
5151
"opbeat",
@@ -145,7 +145,7 @@
145145
"generic-pool": "^3.7.1",
146146
"get-port": "^5.1.1",
147147
"got": "^9.6.0",
148-
"graphql": "^15.3.0",
148+
"graphql": "^15.4.0",
149149
"handlebars": "^4.7.3",
150150
"hapi": "^18.1.0",
151151
"https-pem": "^2.0.0",

test/instrumentation/_agent.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = function mockAgent (expected, cb) {
2828
_spanFilters: new Filters(),
2929
_transport: mockClient(expected, cb || noop),
3030
logger: consoleLogLevel({
31-
level: 'fatal'
31+
level: process.env.ELASTIC_APM_LOG_LEVEL || 'fatal'
3232
}),
3333
setFramework: function () {}
3434
}

test/instrumentation/modules/http/aborted-requests-enabled.js

+20-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,22 @@ test('client-side abort below error threshold - call end', { timeout: 10000 }, f
3636

3737
var server = http.createServer(function (req, res) {
3838
setTimeout(function () {
39+
// Explicitly respond with headers before aborting the client request,
40+
// because:
41+
// (a) `assert(t, data)` above asserts that `trans.result` has been set
42+
// to "HTTP 2xx", which depends on the wrapped `writeHead` having been
43+
// called, and
44+
// (b) calling res.write('...') or res.end('...') *after* a clientReq.abort()
45+
// in node >=15 leads to a race on whether `ServerResponse.writeHead()`
46+
// is called.
47+
//
48+
// The race:
49+
// - clientReq.abort() closes the client-side of the socket
50+
// - The server-side of the socket closes (`onClose` in lib/_http_agent.js)
51+
// - (race) If the server-side socket is closed before `res.write` is
52+
// called, then res.writeHead() will not be called as of this change:
53+
// https://github.com/nodejs/node/pull/31818/files#diff-48d21edbddb6e855d1ee5716c49bcdc0d913c11ee8a24a98ea7dbc60cd253556L661-R706
54+
res.writeHead(200)
3955
clientReq.abort()
4056
res.write('sync write')
4157
process.nextTick(function () {
@@ -80,9 +96,10 @@ test('client-side abort above error threshold - call end', function (t) {
8096

8197
var server = http.createServer(function (req, res) {
8298
setTimeout(function () {
99+
res.writeHead(200) // See race comment above.
83100
clientReq.abort()
84101
setTimeout(function () {
85-
res.write('Hello') // server emits clientError if written in same tick as abort
102+
res.write('Hello')
86103
setTimeout(function () {
87104
res.end(' World')
88105
}, 10)
@@ -197,6 +214,7 @@ test('server-side abort below error threshold and socket closed - call end', fun
197214
}
198215

199216
var server = http.createServer(function (req, res) {
217+
res.writeHead(200) // See race comment above.
200218
setTimeout(function () {
201219
t.ok(timedout, 'should have closed socket')
202220
t.notOk(ended, 'should not have ended transaction')
@@ -240,6 +258,7 @@ test('server-side abort above error threshold and socket closed - call end', fun
240258
}
241259

242260
var server = http.createServer(function (req, res) {
261+
res.writeHead(200) // See race comment above.
243262
setTimeout(function () {
244263
t.ok(timedout, 'should have closed socket')
245264
t.notOk(ended, 'should not have ended transaction')

0 commit comments

Comments
 (0)