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

When using Next.js SDK with Sentry.requestDataIntegration({ include: { ip: true } }) on the server, IP is always ip:::ffff:127.0.0.1 or some variant of localhost #13245

Open
3 tasks done
Pikachews opened this issue Aug 6, 2024 · 2 comments
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK

Comments

@Pikachews
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

8.22.0

Framework Version

14.2.4

Link to Sentry event

https://test-application-g0.sentry.io/issues/5682136612/?project=4507729342496768

Reproduction Example/SDK Setup

sentry.server.config.ts/sentry.edge.config.ts

Sentry.init({
  dsn: dsn,
  ...,
  integrations: [
    Sentry.requestDataIntegration({
      include: { ip: true },
    }),
  ],
});

pages/api/test-error.ts

import type { NextApiRequest, NextApiResponse } from "next";

export default function handler(req: NextApiRequest, res: NextApiResponse) {
  throw new Error("text error");
}

Steps to Reproduce

  1. Visit /api/test-error
  2. View the created issue in Sentry

Expected Result

The IP address field should be the one contained in X-Forwarded-For or X-Real-Ip.

Actual Result

The IP address used is always ip:::ffff:127.0.0.1 (or some variant of localhost).

@github-actions github-actions bot added the Package: nextjs Issues related to the Sentry Nextjs SDK label Aug 6, 2024
@Pikachews Pikachews changed the title When using Next.js SDK with Sentry.requestDataIntegration({ include: { ip: true } }) on the server, IP is always ip:::ffff:127.0.0.1 or some variant of localhost When using Next.js SDK with Sentry.requestDataIntegration({ include: { ip: true } }) on the server, IP is always ip:::ffff:127.0.0.1 or some variant of localhost Aug 6, 2024
@andreiborza
Copy link
Member

Hello, thanks for filing this. We'll look into this.

@mydea
Copy link
Member

mydea commented Aug 7, 2024

We looked into this some more, and you are right, the behavior we have today is inconsistent here. I opened an issue to track this, we'll try to fix this soon: #13260

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK
Projects
Status: No status
Development

No branches or pull requests

4 participants