Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Add a Screenshot" button in feedback throws an exception when clicked #13151

Closed
3 tasks done
rjd22 opened this issue Aug 1, 2024 · 2 comments
Closed
3 tasks done

"Add a Screenshot" button in feedback throws an exception when clicked #13151

rjd22 opened this issue Aug 1, 2024 · 2 comments
Labels
Package: vue Issues related to the Sentry Vue SDK Type: Bug

Comments

@rjd22
Copy link

rjd22 commented Aug 1, 2024

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/vue

SDK Version

8.22.0

Framework Version

Vue 3.4.21

Link to Sentry event

No response

Reproduction Example/SDK Setup

System:
Arch Linux on Wayland (Add needed modules to make screenshots are installed and recording works fine)
Firefox (Lastest version)

Stack trace of error:

Uncaught (in promise) ReferenceError: h is not defined
    CropCorner ScreenshotEditor.tsx:341
    Preact 23
        q$1
        M
        P$1
        z$1
        M
        P$1
        z$1
        M
        P$1
        z$1
        M
        P$1
        M
        P$1
        z$1
        M
        P$1
        M
        w$1
        C$1
        promise callback*x$1
        setState
        __
    onClick Form.tsx:207
    Preact 32
        D$1
        A$1
        z$1
        M
        P$1
        z$1
        M
        P$1
        z$1
        M
        P$1
        z$1
        M
        P$1
        z$1
        M
        P$1
        M
        P$1
        z$1
        M
        P$1
        z$1
        M
        P$1
        z$1
        M
        P$1
        M
        P$1
        M
        B$1
    renderContent integration.tsx:66
    open integration.tsx:52
    handleClick2 integration.ts:245
    _attachTo integration.ts:247
    <anonymous> main.js:98

Config used:

  const feedback = Sentry.feedbackIntegration({
    autoInject: false,
    isNameRequired: true,
    isEmailRequired: true,
    showBranding: false,
    colorScheme: "system",
  });

  const feedbackButton = document.querySelector("#sentry-feedback");

  feedback.attachTo(feedbackButton);

  // Load sentry with feedback and recording
  Sentry.init({
    app,
    dsn: import.meta.env.VITE_SENTRY_DSN,
    release: import.meta.env.VITE_RELEASE_VERSION,
    integrations: [
      Sentry.browserTracingIntegration(),
      Sentry.replayIntegration(),
      feedback,
    ],
    trackComponents: true,
    tracesSampleRate: 0.01,
    replaysSessionSampleRate: 0.01,
    replaysOnErrorSampleRate: 1.0,
  });

Steps to Reproduce

  1. Click on feedback-button to open feedback form
  2. Click on "Add a screenshot" button

Expected Result

I except a screenshot being made of my screen

Actual Result

Error is thrown.

@rjd22 rjd22 added the Type: Bug label Aug 1, 2024
@github-actions github-actions bot added the Package: vue Issues related to the Sentry Vue SDK label Aug 1, 2024
@chargome
Copy link
Member

chargome commented Aug 1, 2024

Hey @rjd22,

you will need to attach the button after mounting your app:

const app = createApp(App);

Sentry.init({
  app,
  dsn: "YOUR_DSN",
  integrations: [
    Sentry.feedbackIntegration({
      autoInject: false,
      isNameRequired: true,
      isEmailRequired: true,
      showBranding: false,
      colorScheme: "system",
    }),
  ],
});

app.mount("#app");

const feedback = Sentry.getFeedback();
const feedbackButton = document.querySelector("#sentry-feedback");
feedback?.attachTo(feedbackButton!);

@rjd22
Copy link
Author

rjd22 commented Aug 1, 2024

Thx! Everything is loading correctly now.

@rjd22 rjd22 closed this as completed Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: vue Issues related to the Sentry Vue SDK Type: Bug
Projects
Archived in project
Development

No branches or pull requests

2 participants