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

Warning when console logging Vue ViewModel #8980

Closed
3 tasks done
Duncanxyz opened this issue Sep 8, 2023 · 3 comments · Fixed by #8981
Closed
3 tasks done

Warning when console logging Vue ViewModel #8980

Duncanxyz opened this issue Sep 8, 2023 · 3 comments · Fixed by #8981
Labels
Package: vue Issues related to the Sentry Vue SDK Type: Bug

Comments

@Duncanxyz
Copy link
Contributor

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

7.68.0

Framework Version

2.7.14

Link to Sentry event

No response

SDK Setup

Sentry.init({
  Vue,
  dsn: 'https://[email protected]/0',
  integrations: [
    new Sentry.BrowserTracing({}),
    new Sentry.Replay({
      maskAllText: false,
      maskAllInputs: false,
      blockAllMedia: false,
    }),
  ],
  tracesSampleRate: 1.0,
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0,
});

Steps to Reproduce

  1. Console logging a Vue instance (ViewModel) during the rendering process.

Reproduce the issue in this codepen.

Expected Result

No warnings should appear.

Actual Result

Some warnings appear.

image

(found in <Root>)
(anonymous) @ instrument.ts:144
warn$2 @ vue.js:5108
warnNonPresent_1 @ vue.js:660
has @ vue.js:699
isSyntheticEvent @ is.ts:153
stringifyValue @ normalize.ts:218
visit @ normalize.ts:89
normalize @ normalize.ts:39
(anonymous) @ handleScope.ts:95
normalizeConsoleBreadcrumb @ handleScope.ts:81
handleScope @ handleScope.ts:62
(anonymous) @ handleScope.ts:26
(anonymous) @ scope.ts:594
_notifyScopeListeners @ scope.ts:593
setSpan @ scope.ts:287
finish @ idletransaction.ts:194
(anonymous) @ idletransaction.ts:288
sentryWrapped @ helpers.ts:98
setTimeout (async)
(anonymous) @ trycatch.ts:122
_restartIdleTimeout @ idletransaction.ts:285
_popActivity @ idletransaction.ts:324
popActivity @ idletransaction.ts:227
span.finish @ idletransaction.ts:50
(anonymous) @ tracing.ts:44
sentryWrapped @ helpers.ts:98
setTimeout (async)
(anonymous) @ trycatch.ts:122
finishRootSpan @ tracing.ts:42
mixins.<computed> @ tracing.ts:124
invokeWithErrorHandling @ vue.js:3700
callHook$1 @ vue.js:3104
mountComponent @ vue.js:2978
Vue.$mount @ vue.js:9311
Vue.$mount @ vue.js:11870
Vue._init @ vue.js:4724
Vue @ vue.js:5774
(anonymous) @ origin.html:48
instrument.ts:144 [Vue warn]: Property or method "preventDefault" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Sep 8, 2023
@github-actions github-actions bot added the Package: vue Issues related to the Sentry Vue SDK label Sep 8, 2023
@Lms24
Copy link
Member

Lms24 commented Sep 8, 2023

Hi @Duncanxyz thanks for writing in and for opening a PR!

I already left a review in #8981 but I have one more general question:

Since you already took a look at the code, can you explain why this warning appears? Is it because adding the console log breadcrumb accesses certain properties within Vue triggers some kind of proxy that emits the warning?

Furthermore, is this only problematic in Vue 2 or is it still a problem in Vue 3?

@Duncanxyz
Copy link
Contributor Author

Hi @Lms24 , thank you for your review!

You're correct in your understanding of the warning's cause. In Vue 2, there is a proxy during the rendering process.
Vue2 related source code

I apologize for not considering the differences with Vue 3 earlier. I will further investigate and update the PR in the next couple of days.

Thank you once again for your prompt response. Sentry is crucial to our project!

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Sep 8, 2023
@getsantry getsantry bot removed the status in GitHub Issues with 👀 Sep 13, 2023
Lms24 pushed a commit that referenced this issue Sep 13, 2023
Prevent stringifying VueViewModel objects which causes a warning when the object is logged to console. Instead, normalize it's string value to `"[VueViewModel]"`

More details in #8980
@AbhiPrasad
Copy link
Member

Thanks for contributing a fix @Duncanxyz. It has been released in 7.69.0 https://github.com/getsentry/sentry-javascript/releases/tag/7.69.0

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

Successfully merging a pull request may close this issue.

3 participants