<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script
src="https://browser.sentry-cdn.com/10.8.0/bundle.tracing.replay.feedback.js"
crossorigin="anonymous"
></script>
</head>
<body>
<h1>Sentry sendFeedback test</h1>
<div>
<span>Status:</span>
<span id="status">Waiting</span>
</div>
<button onclick="Sentry.captureException(new Error('Test Error'))">
Capture Exception
</button>
<script>
const getAndSendUserFeedback = eventId => {
// Assume this came from a form that was shown to the user
const userFeedback = {
name: "Name",
email: "user@example.com",
message: "Feedback message",
associatedEventId: eventId,
};
const request = Sentry.sendFeedback(userFeedback);
request.then(response => {
if (response.status === 200) {
document.querySelector("#status").textContent = "Success";
} else {
document.querySelector("#status").textContent = "Failure";
}
})
.catch(() => {
document.querySelector("#status").textContent = "Failure";
});
};
window.addEventListener("load", function () {
Sentry.init({
dsn: "DSN_URL_HERE",
environment: "development",
beforeSend(event, hint) {
if (event.exception && event.event_id) {
// Open feedback form to get user feedback
getAndSendUserFeedback(event.event_id);
}
return event;
},
integrations: [
Sentry.feedbackIntegration({
autoInject: false,
}),
],
});
});
</script>
</body>
</html>
Run the script above and click the "Capture Exception" button.
User feedback should be sent normally.
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
Sentry Browser CDN bundle
SDK Version
10.8.0
Framework Version
No response
Link to Sentry event
https://dragonfruit-us.sentry.io/issues/6854262666/?query=is%3Aunresolved&referrer=issue-stream
Reproduction Example/SDK Setup
Steps to Reproduce
Run the script above and click the "Capture Exception" button.
Expected Result
User feedback should be sent normally.
Actual Result
The app throws the error
Sentry.sendFeedback is not a function. I also tested this in my own test application and gotFailed to send feedback: window.Sentry.sendFeedback is not a functionin the browser console.