support @koa/router@11 and @koa/router@12
See original GitHub issue@koa/router
(aka koa-router
) v11.0.0 was released a few days ago. We should update our instrumentation to support it.
Some notes:
- koa-router v11 dropped support for node <v12.
- However, just after the v11 release testing of node v12 was dropped from their CI: https://github.com/koajs/router/commit/fdf7117ad01e248c4726ae2730a5f70a32e1d547 I’ve asked on that commit what node version is actually supported. That doesn’t break us… just might later in our TAV tests. -> v12 is still supported, just not tested in CI.
- Current instrumentation tests fail with the new koa-router:
% npm install @koa/router@11
...
% node --version
v16.15.1
% node test/instrumentation/modules/koa-router/new-name.test.js
TAP version 13
# route naming
ok 1 should be strictly equal
ok 2 should be strictly equal
not ok 3 should be strictly equal
---
operator: equal
expected: 'GET /hello'
actual: 'GET unknown route'
at: assert (/Users/trentm/el/apm-agent-nodejs8/test/instrumentation/modules/koa-router/shared.js:150:7)
stack: |-
Error: should be strictly equal
at Test.assert [as _assert] (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:314:54)
at Test.bound [as _assert] (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:99:32)
at Test.strictEqual (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:478:10)
at Test.bound [as strictEqual] (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:99:32)
at assert (/Users/trentm/el/apm-agent-nodejs8/test/instrumentation/modules/koa-router/shared.js:150:7)
at /Users/trentm/el/apm-agent-nodejs8/test/instrumentation/modules/koa-router/shared.js:34:7
at Object._write (/Users/trentm/el/apm-agent-nodejs8/test/_mock_http_client.js:46:50)
at Object.sendTransaction (/Users/trentm/el/apm-agent-nodejs8/test/_mock_http_client.js:53:12)
at Instrumentation.addEndedTransaction (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/index.js:339:20)
at Transaction.end (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/transaction.js:356:32)
at ServerResponse.<anonymous> (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/http-shared.js:49:36)
at ServerResponse.f (/Users/trentm/el/apm-agent-nodejs8/node_modules/once/once.js:25:25)
at ServerResponse.onfinish (/Users/trentm/el/apm-agent-nodejs8/node_modules/end-of-stream/index.js:31:27)
at /Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/run-context/AbstractRunContextManager.js:82:49
at AsyncHooksRunContextManager.with (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/run-context/BasicRunContextManager.js:65:17)
at ServerResponse.wrapper (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/run-context/AbstractRunContextManager.js:82:23)
at ServerResponse.emit (node:events:539:35)
at onFinish (node:_http_outgoing:830:10)
at callback (node:internal/streams/writable:552:21)
at afterWrite (node:internal/streams/writable:497:5)
at afterWriteTick (node:internal/streams/writable:484:10)
at processTicksAndRejections (node:internal/process/task_queues:82:21)
...
ok 4 should be strictly equal
ok 5 should be strictly equal
ok 6 should be strictly equal
ok 7 should be strictly equal
ok 8 should be strictly equal
# route naming with params
ok 9 should be strictly equal
ok 10 should be strictly equal
not ok 11 should be strictly equal
---
operator: equal
expected: |-
'GET /hello/:name'
actual: |-
'GET unknown route'
at: assert (/Users/trentm/el/apm-agent-nodejs8/test/instrumentation/modules/koa-router/shared.js:150:7)
stack: |-
Error: should be strictly equal
at Test.assert [as _assert] (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:314:54)
at Test.bound [as _assert] (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:99:32)
at Test.strictEqual (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:478:10)
at Test.bound [as strictEqual] (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:99:32)
at assert (/Users/trentm/el/apm-agent-nodejs8/test/instrumentation/modules/koa-router/shared.js:150:7)
at /Users/trentm/el/apm-agent-nodejs8/test/instrumentation/modules/koa-router/shared.js:52:7
at Object._write (/Users/trentm/el/apm-agent-nodejs8/test/_mock_http_client.js:46:50)
at Object.sendTransaction (/Users/trentm/el/apm-agent-nodejs8/test/_mock_http_client.js:53:12)
at Instrumentation.addEndedTransaction (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/index.js:339:20)
at Transaction.end (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/transaction.js:356:32)
at ServerResponse.<anonymous> (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/http-shared.js:49:36)
at ServerResponse.f (/Users/trentm/el/apm-agent-nodejs8/node_modules/once/once.js:25:25)
at ServerResponse.onfinish (/Users/trentm/el/apm-agent-nodejs8/node_modules/end-of-stream/index.js:31:27)
at /Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/run-context/AbstractRunContextManager.js:82:49
at AsyncHooksRunContextManager.with (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/run-context/BasicRunContextManager.js:65:17)
at ServerResponse.wrapper (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/run-context/AbstractRunContextManager.js:82:23)
at ServerResponse.emit (node:events:539:35)
at onFinish (node:_http_outgoing:830:10)
at callback (node:internal/streams/writable:552:21)
at afterWrite (node:internal/streams/writable:497:5)
at afterWriteTick (node:internal/streams/writable:484:10)
at processTicksAndRejections (node:internal/process/task_queues:82:21)
...
ok 12 should be strictly equal
ok 13 should be strictly equal
ok 14 should be strictly equal
ok 15 should be strictly equal
ok 16 should be strictly equal
# nested routes
ok 17 should be strictly equal
ok 18 should be strictly equal
not ok 19 should be strictly equal
---
operator: equal
expected: 'GET /prefix1/prefix2/hello'
actual: 'GET unknown route'
at: assert (/Users/trentm/el/apm-agent-nodejs8/test/instrumentation/modules/koa-router/shared.js:150:7)
stack: |-
Error: should be strictly equal
at Test.assert [as _assert] (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:314:54)
at Test.bound [as _assert] (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:99:32)
at Test.strictEqual (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:478:10)
at Test.bound [as strictEqual] (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:99:32)
at assert (/Users/trentm/el/apm-agent-nodejs8/test/instrumentation/modules/koa-router/shared.js:150:7)
at /Users/trentm/el/apm-agent-nodejs8/test/instrumentation/modules/koa-router/shared.js:70:7
at Object._write (/Users/trentm/el/apm-agent-nodejs8/test/_mock_http_client.js:46:50)
at Object.sendTransaction (/Users/trentm/el/apm-agent-nodejs8/test/_mock_http_client.js:53:12)
at Instrumentation.addEndedTransaction (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/index.js:339:20)
at Transaction.end (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/transaction.js:356:32)
at ServerResponse.<anonymous> (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/http-shared.js:49:36)
at ServerResponse.f (/Users/trentm/el/apm-agent-nodejs8/node_modules/once/once.js:25:25)
at ServerResponse.onfinish (/Users/trentm/el/apm-agent-nodejs8/node_modules/end-of-stream/index.js:31:27)
at /Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/run-context/AbstractRunContextManager.js:82:49
at AsyncHooksRunContextManager.with (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/run-context/BasicRunContextManager.js:65:17)
at ServerResponse.wrapper (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/run-context/AbstractRunContextManager.js:82:23)
at ServerResponse.emit (node:events:539:35)
at onFinish (node:_http_outgoing:830:10)
at callback (node:internal/streams/writable:552:21)
at afterWrite (node:internal/streams/writable:497:5)
at afterWriteTick (node:internal/streams/writable:484:10)
at processTicksAndRejections (node:internal/process/task_queues:82:21)
...
ok 20 should be strictly equal
ok 21 should be strictly equal
ok 22 should be strictly equal
ok 23 should be strictly equal
ok 24 should be strictly equal
# nested routes with params
ok 25 should be strictly equal
ok 26 should be strictly equal
not ok 27 should be strictly equal
---
operator: equal
expected: |-
'GET /prefix1/prefix2/hello/:name'
actual: |-
'GET unknown route'
at: assert (/Users/trentm/el/apm-agent-nodejs8/test/instrumentation/modules/koa-router/shared.js:150:7)
stack: |-
Error: should be strictly equal
at Test.assert [as _assert] (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:314:54)
at Test.bound [as _assert] (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:99:32)
at Test.strictEqual (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:478:10)
at Test.bound [as strictEqual] (/Users/trentm/el/apm-agent-nodejs8/node_modules/tape/lib/test.js:99:32)
at assert (/Users/trentm/el/apm-agent-nodejs8/test/instrumentation/modules/koa-router/shared.js:150:7)
at /Users/trentm/el/apm-agent-nodejs8/test/instrumentation/modules/koa-router/shared.js:88:7
at Object._write (/Users/trentm/el/apm-agent-nodejs8/test/_mock_http_client.js:46:50)
at Object.sendTransaction (/Users/trentm/el/apm-agent-nodejs8/test/_mock_http_client.js:53:12)
at Instrumentation.addEndedTransaction (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/index.js:339:20)
at Transaction.end (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/transaction.js:356:32)
at ServerResponse.<anonymous> (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/http-shared.js:49:36)
at ServerResponse.f (/Users/trentm/el/apm-agent-nodejs8/node_modules/once/once.js:25:25)
at ServerResponse.onfinish (/Users/trentm/el/apm-agent-nodejs8/node_modules/end-of-stream/index.js:31:27)
at /Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/run-context/AbstractRunContextManager.js:82:49
at AsyncHooksRunContextManager.with (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/run-context/BasicRunContextManager.js:65:17)
at ServerResponse.wrapper (/Users/trentm/el/apm-agent-nodejs8/lib/instrumentation/run-context/AbstractRunContextManager.js:82:23)
at ServerResponse.emit (node:events:539:35)
at onFinish (node:_http_outgoing:830:10)
at callback (node:internal/streams/writable:552:21)
at afterWrite (node:internal/streams/writable:497:5)
at afterWriteTick (node:internal/streams/writable:484:10)
at processTicksAndRejections (node:internal/process/task_queues:82:21)
...
ok 28 should be strictly equal
ok 29 should be strictly equal
ok 30 should be strictly equal
ok 31 should be strictly equal
ok 32 should be strictly equal
1..32
# tests 32
# pass 28
# fail 4
Issue Analytics
- State:
- Created a year ago
- Comments:13 (11 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
the env was the cause of the bug, thanks
I will try to solve the koa 11/12 now
to test against koa 12 I need to install koa 12 and run the tests?
That’s right:
And we’ll eventually want to replace the koa-router block in “.tav.yml” with something like this:
and then get the following running with the supported versions of node:
However, start with the former.