Skip to content

Fastify Instrumentation does not Capture Request Body #1906

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

Closed
astorm opened this issue Dec 3, 2020 · 0 comments · Fixed by #2681
Closed

Fastify Instrumentation does not Capture Request Body #1906

astorm opened this issue Dec 3, 2020 · 0 comments · Fixed by #2681
Labels
agent-nodejs Make available for APM Agents project planning.

Comments

@astorm
Copy link
Contributor

astorm commented Dec 3, 2020

Unsure if this is an enhancement request or a bug report, but it looks like our fastify instrumentation does not collect the request bodies as captured by the standard fastify-formbody middlware. Fastify populates it's own Request object's body property (request.body) with these values, but [we read our request bodies in from the native node IncomeingMessage/Request object, which is different from fastify's.

You can observe this behavior by running the following small sample program

const fastify = require('fastify')()

fastify.register(require('fastify-formbody'))

fastify.post('/test', (req, reply) => {
  console.log(req.body)
  reply.send("Hello World")
})

const server = fastify.listen(0, '0.0.0.0',(err, address) => {
  if (err) throw err

  console.log(address)
})

and posting some form variables.

$ curl -i http://localhost:3000 -d foo=bar

Fastify captures the request body, but if you examine the generated transactions, no request body is captured.

Ideally our Fastify instrumentation should match our express instrumentation's functionality and capture these values.

@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Dec 3, 2020
@astorm astorm mentioned this issue Dec 4, 2020
9 tasks
trentm added a commit that referenced this issue May 3, 2023
trentm added a commit that referenced this issue May 16, 2023
PeterEinberger pushed a commit to fpm-git/apm-agent-nodejs that referenced this issue Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-nodejs Make available for APM Agents project planning.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant