Skip to content

[Nuxt] beforeSend() is not called #13588

@lud-hu

Description

@lud-hu

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nuxt

SDK Version

8.28.0

Framework Version

Nuxt 3.13.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

import * as Sentry from "@sentry/nuxt";
import { useRuntimeConfig } from "#imports";

const sentryConfig = useRuntimeConfig().public.sentry;

Sentry.init({
  environment: sentryConfig.environment,
  release: sentryConfig.release,
  enabled: sentryConfig.enabled,
  dsn: sentryConfig.dsn,
  integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()],
  debug: true,
  tracesSampleRate: 1.0,
  tracePropagationTargets: [],
  replaysSessionSampleRate: 0.2,
  replaysOnErrorSampleRate: 1.0,

  // Called for message and error events
  beforeSend(event) {
    console.log("Event", event); // Not visible in console :(
    if (event.user) {
      delete event.user.ip_address; // Does not have any effect on the event payload sent to sentry
      delete event.user.geo;
      delete event.user.sentry_user;
      event.user.test = "123";
    }
    return event;
  },
});

Steps to Reproduce

  1. e.g. create a button that throws an error
  2. the error will be sent to the sentry console
  3. check event payload there and see that all changes made in beforeSend() do not have any effect

Expected Result

The event payload can be modified in the beforeSend() as seen in the docs

Actual Result

The event payload stays the same (and includes all user data I want to scrub before sending the event) no matter what I do in the Sentry.init()

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugPackage: nuxtIssues related to the Sentry Nuxt SDK

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions