question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Maximum call stack size exceeded

See original GitHub issue

Description

My Vue app become inaccessible if I pass the router object as the third argument

Vue.use(VueGtag, {
  config: { id: "UA-1234567-1" }
}, router);

Expected behavior

It should let users add vue router, so that GA doesn’t only track the default ‘/’ path for every page view.

Actual behavior

But instead it throws this error

Maximum call stack size exceeded
    at Function.assign (<anonymous>)

Environment

Running npm ls vue-gtag returns `-- vue-gtag@1.9.0

OS: Windows 10 Browser: Google Chrome: Version 85.0.4183.83

Reproducible Demo

I googled this issue and it turns out it may be a caused due to circular reference within vue components. My Vue app is ready and it consists of 100’s of components, it is impossible to find out the circular reference (if there’s any) without checking each and every component one by one. For a quick fix, I am setting the page view manually with

this.$gtag.pageview({ page_path: this.$route.path });

in mounted() method of App.vue

Suggestion

As most people will use this package at the end of any vue project. It would be really helpful , if you can somehow manage to help us spot the file/vue-component/route causing this issue. Otherwise, it would be total nightmare for big projects.

Thanks for reading.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
MatteoGabrielecommented, Oct 6, 2020

@snickbit judging by the example u made, you have to pass the router as a third argument in the use method, not as a property of the second argument. I get that is confusing and that’s why in the next version of vue-gtag for vue 3, this has changed to make it easier to implement

Vue.use(VueGtag, options, router)
0reactions
jowestecommented, Nov 13, 2020

@joweste you have to read tho. The comment right before yours is the correct install.

Thanks. It was solved

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Maximum call stack size exceeded error
It means that somewhere in your code, you are calling a function which in turn calls another function and so forth, until you...
Read more >
JavaScript Error: Maximum Call Stack Size Exceeded
If you see the “Maximum Call Stack Size Exceeded” error, there's likely a problem with a recursive function within your JavaScript code.
Read more >
Uncaught RangeError: Maximum call ... - Net-Informations.Com
Maximum call stack size exceeded error ... This error is almost always means you have a problem with recursion in JavaScript code, as...
Read more >
RangeError: Maximum call stack size exceeded - Educative.io
The most common source for this error is infinite recursion. You must have a recursive function in your code whose base case is...
Read more >
Maximum Call Stack Size Exceeded (Typescript Error) - Medium
Scenario for Maximum Call Stack Size Exceeded Error ... In your code, the possibility is, You are calling a function that is calling...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found