-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I 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 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
<!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: "[email protected]",
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>
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 got Failed to send feedback: window.Sentry.sendFeedback is not a function
in the browser console.
Metadata
Metadata
Assignees
Labels
Projects
Status
No status