You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/06/02 02:54:31 UTC
[GitHub] [skywalking] Midqiu opened a new issue, #9165: [Bug] something went wrong wen use Router in expressjs with skywalking
Midqiu opened a new issue, #9165:
URL: https://github.com/apache/skywalking/issues/9165
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no similar issues.
### Apache SkyWalking Component
NodeJS Server Side Agent (apache/skywalking-nodejs)
### What happened
when i user router in expressjs with skywalking, some went wrong.
```
app.use("/hello/",async function (req, res) {
res.send("Hello")
})
// this is router
const router = express.Router()
router.get("/router/", async function (req, res) {
res.send("Hello router")
})
app.use(router)
app.use("/hello2/", async function (req, res) {
res.send("Hello2");
});
```
and the result is:
this is OK:

but this has two records in skywalking:

and this has two records and tell me has error:

### What you expected to happen
`/router/` and `/hello2/aaa` has one record and has no error。
### How to reproduce
# 1. start this server:
```
var express = require('express')
var agent = require('skywalking-backend-js').default
agent.start({
serviceName: "***",
collectorAddress: "***",
})
const app = express()
app.use("/hello/", async function (req, res) {
res.send("Hello")
})
const router = express.Router()
router.get("/router/", async function (req, res) {
res.send("Hello router")
})
app.use(router)
app.use("/hello2/", async function (req, res) {
res.send("Hello2");
});
const PORT = 4444
app.listen(PORT, () => {
console.log(`Example app listening at http://localhost:${PORT}`)
})
```
# 2. Visit web address
http://localhost:4444/hello/aaa
http://localhost:4444/router/
http://localhost:4444/hello2/aaa
# 3. see the skywalking dashboard
### Anything else
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] Superskyyy commented on issue #9165: [Bug] something went wrong when use Router in expressjs with skywalking
Posted by GitBox <gi...@apache.org>.
Superskyyy commented on issue #9165:
URL: https://github.com/apache/skywalking/issues/9165#issuecomment-1148199869
Closing as fixed ^
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] Superskyyy closed issue #9165: [Bug] something went wrong when use Router in expressjs with skywalking
Posted by GitBox <gi...@apache.org>.
Superskyyy closed issue #9165: [Bug] something went wrong when use Router in expressjs with skywalking
URL: https://github.com/apache/skywalking/issues/9165
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org