Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issuesI have reviewed the documentation https://docs.sentry.io/I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
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.
Metadata
Metadata
Assignees
Type
Projects
Status
No status
Activity
Lms24 commentedon Apr 4, 2025
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!
hbmartin commentedon Apr 4, 2025
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:
So perhaps the solve for this issue is better docs around that pattern?
Lms24 commentedon Apr 4, 2025
Ah I see. I'm not a 100% familiar with feedback but to me it seems odd to call
feedbackIntegration()
and not pass it toSentry.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 addingfeedbackIntegration()
to your client-sideSentry.init
sounds correct to me.I guess you mean this, right? Agreed, this looks misleading. Also forwarded it to the team.
17 remaining items