Skip to content

Koa request body is not captured for events #13722

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
3 tasks done
maximedupre opened this issue Sep 18, 2024 · 4 comments · Fixed by #13746
Closed
3 tasks done

Koa request body is not captured for events #13722

maximedupre opened this issue Sep 18, 2024 · 4 comments · Fixed by #13746
Assignees
Labels
Package: node Issues related to the Sentry Node SDK

Comments

@maximedupre
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

@sentry/node ^8.5.0

Framework Version

koa ^2.15.2

Link to Sentry event

No response

Reproduction Example/SDK Setup

This is my config:

init({
    dsn: '',
    tracesSampleRate: 0.1,
    profilesSampleRate: 1.0,
    normalizeDepth: 11,
    integrations: [nodeProfilingIntegration],
    environment: EnvVariablesUtility.NODE_ENV,
    enabled: EnvVariablesUtility.NODE_ENV !== 'local',
    beforeSend(event, hint) {
        const error = hint.originalException;

        if (isHttpError(error) && error.expose) {
            return null;
        }

        return event;
    },
});

Steps to Reproduce

The RequestData integration is a default integration and according to the doc, the request data should be included by default, however, it is not.

The issue page shows the curl request without the request data:

curl \
 -X POST \
 --compressed \
 -H "Accept: application/json, text/plain, */*" \
 -H "Accept-Encoding: gzip, br" \
 -H "Accept-Language: en-US,en;q=0.9" \
 ...
 "{the_url}"

Expected Result

The issue page shows the request body

Actual Result

The issue page doesn't show the request body

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Sep 18, 2024
@github-actions github-actions bot added the Package: node Issues related to the Sentry Node SDK label Sep 18, 2024
@andreiborza
Copy link
Member

Hi @maximedupre, thanks for writing in.

Are you using @koa/bodyparser? Could you please provide a reproduction repo or stackblitz so we can further investigate?

From my testing, even with the body parser the request passed to the integration doesn't contain the body already 🤔.

@maximedupre
Copy link
Author

Hi @andreiborza,

I'm actually using koa-better-body.

I don't have time to create a repro right now, but when I do I'll be sure to post it here.

Thanks

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Sep 19, 2024
@andreiborza
Copy link
Member

@maximedupre thanks, don't bother with the reproduction we identified the issue. Thanks again for reporting this.

@mydea mydea changed the title The request body isn't displayed on the Sentry issue page Koa request body is not captured for events Sep 23, 2024
@lforst lforst assigned lforst and AbhiPrasad and unassigned lforst Nov 4, 2024
@AbhiPrasad AbhiPrasad removed their assignment Nov 11, 2024
@mydea mydea closed this as completed in a55e2b0 Nov 13, 2024
Copy link
Contributor

A PR closing this issue has just been released 🚀

This issue was referenced by PR #13746, which was included in the 8.39.0 release.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Package: node Issues related to the Sentry Node SDK
Projects
Archived in project
5 participants