Skip to content

Next.js error TypeError: (0 , _sentry_nextjs__WEBPACK_IMPORTED_MODULE_11__.feedbackIntegration) is not a function #15977

Closed
getsentry/sentry-docs
#13247
@hbmartin

Description

@hbmartin

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

9.11.0

Framework Version

Next 15.2.4

Link to Sentry event

No response

Reproduction Example/SDK Setup

I am unable to import and use feedbackIntegration.

I have my instrumentation-client.ts configured as:

import * as Sentry from "@sentry/nextjs";

Sentry.init({
  dsn: "dsn",

  // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
  tracesSampleRate: 1,

  // Setting this option to true will print useful information to the console while you're setting up Sentry.
  debug: false,

  integrations: [
    Sentry.feedbackIntegration({
      showBranding: false,
      autoInject: false,
    }),
  ],
});

Steps to Reproduce

Either of these blocks:

import { feedbackIntegration } from "@sentry/nextjs";
...
const feedback = feedbackIntegration({
  // Disable the injection of the default widget
  autoInject: false,
});

OR

import * as Sentry from "@sentry/nextjs";
...
const feedback = Sentry.feedbackIntegration({
  // Disable the injection of the default widget
  autoInject: false,
});

Expected Result

The import should work or there should be docs on correct import

Actual Result

Next.js error TypeError: (0 , _sentry_nextjs__WEBPACK_IMPORTED_MODULE_11__.feedbackIntegration) is not a function The same is true for both repro blocks.

Activity

added theissue type on Apr 3, 2025
moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Apr 3, 2025
Lms24

Lms24 commented on Apr 4, 2025

@Lms24
Member

Hey @hbmartin thanks for writing in! I tried to reproduce this in a new NextJS app on 15.2.4 and couldn't get to the error. See my reproduction repo. Can you let me know what to change in this repro to reproduce the error? Otherwise, feel free to provide your own repro. thanks!

moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Apr 4, 2025
moved this to Waiting for: Community in GitHub Issues with 👀 3on Apr 4, 2025
hbmartin

hbmartin commented on Apr 4, 2025

@hbmartin
Author

Hi thanks for the response @Lms24
That repro repo (😅) is only calling Sentry.feedbackIntegration in the config file but I was referring to manually calling it in UI component.
I was able to solve this in my UI component by doing:

import { getFeedback } from "@sentry/nextjs";
...
const feedback = getFeedback();
const form = await feedback.createForm(...)

So perhaps the solve for this issue is better docs around that pattern?

moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 3on Apr 4, 2025
Lms24

Lms24 commented on Apr 4, 2025

@Lms24
Member

Ah I see. I'm not a 100% familiar with feedback but to me it seems odd to call feedbackIntegration() and not pass it to Sentry.init. I'll talk to the Feedback team about this.

However, if you call feedbackIntegration() and get this error, does it appear on your sever-side? This would explain it because the feedback integration is client-only. So you need to ensure that this is never executed on the server (e.g. during SSR).

Anyway, calling getFeedback() in combination with adding feedbackIntegration() to your client-side Sentry.init sounds correct to me.

So perhaps the solve for this issue is better docs around that pattern?

I guess you mean this, right? Agreed, this looks misleading. Also forwarded it to the team.

17 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Next.js error `TypeError: (0 , _sentry_nextjs__WEBPACK_IMPORTED_MODULE_11__.feedbackIntegration) is not a function` · Issue #15977 · getsentry/sentry-javascript