Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Sentry.sendFeedback is not a function when using the CDN #17516

Closed
@InterstellarStella

Description

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

<!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>

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

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /