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

[Bug] something went wrong when use Router in expressjs with skywalking #9165

Closed
2 of 3 tasks
Midqiu opened this issue Jun 2, 2022 · 1 comment
Closed
2 of 3 tasks
Assignees
Labels
agent Language agent related. bug Something isn't working and you are sure it's a bug! nodejs NodeJS backend agent related
Milestone

Comments

@Midqiu
Copy link

Midqiu commented Jun 2, 2022

Search before asking

  • I had searched in the issues 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:
)(G$S26HXV8(Q$PFMR82R`B

but this has two records in skywalking:
MTL`BUD38((@L5J5EF2%(OE

and this has two records and tell me has error:
SW9_4ZP%`AC9L1EYD%SL(@4

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

@Midqiu Midqiu added the bug Something isn't working and you are sure it's a bug! label Jun 2, 2022
@Midqiu Midqiu changed the title [Bug] something went wrong wen use Router in expressjs with skywalking [Bug] something went wrong when use Router in expressjs with skywalking Jun 2, 2022
@Superskyyy Superskyyy added agent Language agent related. nodejs NodeJS backend agent related labels Jun 2, 2022
@Superskyyy
Copy link
Member

Closing as fixed ^

@wu-sheng wu-sheng added this to the NodeJS 0.5.0 milestone Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent Language agent related. bug Something isn't working and you are sure it's a bug! nodejs NodeJS backend agent related
Projects
None yet
Development

No branches or pull requests

5 participants