Skip to content

Attempted import error: 'Replay' is not exported from '@sentry/nextjs' (imported as 'Sentry'). #9796

Closed as not planned
@curiousercreative

Description

@curiousercreative

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

7.86.0

Framework Version

Next.js 14.0.4

Link to Sentry event

No response

SDK Setup

import { CaptureConsole as CaptureConsoleIntegration } from '@sentry/integrations'
import * as Sentry from '@sentry/nextjs'

Sentry.init({
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
  environment: process.env.NEXT_PUBLIC_SENTRY_ENV || process.env.NEXT_PUBLIC_APP_ENV,
  tracesSampleRate: Number(process.env.NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE) || 0,
  integrations: [
    new CaptureConsoleIntegration({
      // array of methods that should be captured
      // defaults to ['log', 'info', 'warn', 'error', 'debug', 'assert']
      levels: [ 'error' ],
    }),
    new Sentry.Replay({
      maskAllText: false,
      blockAllMedia: false,
    }),
  ],
  replaysSessionSampleRate: 0,
  replaysOnErrorSampleRate: 1.0, // overrides replaysSessionSampleRate when an error occurs
})

Steps to Reproduce

  1. pnpm build

Expected Result

no errors

Actual Result

 ⚠ Compiled with warnings

./src/lib/sentry/index.ts
Attempted import error: 'Replay' is not exported from '@sentry/nextjs' (imported as 'Sentry').

Import trace for requested module:
./src/lib/sentry/index.ts
./src/app/global-error.tsx

./src/lib/sentry/index.ts
Attempted import error: 'Replay' is not exported from '@sentry/nextjs' (imported as 'Sentry').

Import trace for requested module:
./src/lib/sentry/index.ts
./src/app/layout.tsx

./src/lib/sentry/index.ts
Attempted import error: 'Replay' is not exported from '@sentry/nextjs' (imported as 'Sentry').

Import trace for requested module:
./src/lib/sentry/index.ts
./src/app/api/reset-password/route.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Type

    No type

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions