title: How to correct, Maximum call stack size exceeded, vue-router?
body: <p>Good day.
  I have the following error:</p>
  
  <pre><code>[vue-router] uncaught error during route navigation:
  vue-router.esm.js:1897 RangeError: Maximum call stack size exceeded
      at String.replace (&lt;anonymous&gt;)
      at resolvePath (vue-router.esm.js:597)
      at normalizeLocation (vue-router.esm.js:1297)
      at Object.match (vue-router.esm.js:1341)
      at VueRouter.match (vue-router.esm.js:2461)
      at HashHistory.transitionTo (vue-router.esm.js:1865)
      at HashHistory.push (vue-router.esm.js:2267)
      at eval (vue-router.esm.js:1952)
      at router.beforeEach (index.js:116)
      at iterator (vue-router.esm.js:1935)
  </code></pre>
  
  <p>According to the error it is in my file of routes, which I have it in the following way:</p>
  
  <pre><code>import Vue from 'vue'
  import Router from 'vue-router'
  import Home from '../components/Home'
  import Vehiculos from '../components/Vehiculos'
  import Perfil from '../components/Perfil'
  import Login from '../components/Login'
  import TutorialIntroduccion from '../components/TutorialIntroduccion'
  import Politicas from '../components/Politicas'
  import Parqueo from '../components/Parqueo'
  import Politicas from '../components/Politicas'
  import Historial from '../components/Historial'
  import firebase from 'firebase'
  
  Vue.use(Router)
  
  let tutorialVisto = localStorage.getItem("Tutorial");
  
  const router = new Router({
    routes: [
     {
      path: '*',
      redirect: '/login'
  
     },
     {
      path: '/',
      redirect: '/tutorial'
     },
     {
      path: '/tutorial',
      name: 'tutorial',
      component: TutorialIntroduccion,
      meta: {
        tutorialVisto: tutorialVisto,
        autentificado: false
      },
      beforeEnter: (to, from, next) =&gt; {
        let tutorialVisto = to.matched.some(record=&gt;record.meta.tutorialVisto);
        if (tutorialVisto)next('login');
        else next();
      }
     },
     {
        path: '/login',
        name: 'Login',
        component: Login
     },
     {
        path: '/home',
        name: 'home',
        component: Home,
        meta: {
          autentificado: true
        }
      },
      {
        path: '/parqueo/:id',
        name: 'parqueo',
        component: Parqueo,
        meta: {
          autentificado: true
        }
      },
      {
        path: '/vehiculos',
        name: 'vehiculos',
        component: Vehiculos,
        meta: {
          autentificado: true
        }
      },
      {
        path: '/perfil',
        name: 'perfil',
        component: Perfil,
        meta: {
          autentificado: true
        }
      },
      {
        path: '/politicas',
        name: 'politicas',
        component: Politicas,
        meta: {
          autentificado: true
        },
      },
      {
          path: '/historial',
          name: 'historial',
          component: Historial,
          meta:{
            autentificado: true
          }
      }
    ]
  })
  router.beforeEach((to, from, next) =&gt; {
    let usuario = firebase.auth().currentUser; //Debe ser otra Promesa si esta autenticado o no.
    let autorizacion = to.matched.some(record=&gt;record.meta.autentificado);
    let tutorialVisto = to.matched.some(record=&gt;record.meta.tutorialVisto);
    if (autorizacion &amp;&amp; !usuario) {
      next('login');
    }
    else if (!autorizacion &amp;&amp; usuario) {
      next('home');
    } 
    else{
      next();
    }   
  })
  export default router;
  </code></pre>
  
  <p>The problem arises when I am in the parking lot view and then when I log in, it does not redirect me to the vita login, but it gives me that error and stays in the same view, although it does close the firebase session. If I am in any of the other views, for example, vehicles, profile or main and then I give in closing session does not generate me error.</p>
  
  <p>The session closing code is the following:</p>
  
  <pre><code>linkto(pathname) {
              this.$router.push({ path: pathname })
              if(pathname=="/login") {
                  firebase.auth().signOut().then(() =&gt; this.$router.replace('login'))
              }
          },
  </code></pre>