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

'this$1' undefined in confirmTransition when redirect using next('/') in router.beforeEach #3076

louisliu15 opened this issue Dec 23, 2019 · 1 comment


Copy link

@louisliu15 louisliu15 commented Dec 23, 2019

Version: 3.1.3
always has an error when replacing route with another path in router.beforeEach(). Sample code is as follow:

router.beforeEach(function (to, from, next) {
  const hasAccess = store.dispatch('oidcStore/oidcCheckAccess', to);
  if (!hasAccess) {
    next({ name: 'unauthorized', replace: true, });
  else {

the error comes from comfirmTransition() starts from vue-router.esm.js line 2115:

var iterator = function (hook, next) {
    if (this$1.pending !== route) {
      return abort()
    try {
      hook(route, current, function (to) {
        if (to === false || isError(to)) {
          // next(false) -> abort navigation, ensure current URL
        } else if (
          typeof to === 'string' ||
          (typeof to === 'object' &&
            (typeof to.path === 'string' || typeof === 'string'))
        ) {
          // next('/') or next({ path: '/' }) -> redirect
          if (typeof to === 'object' && to.replace) {
          } else {
        } else {
          // confirm transition and pass on the value
    } catch (e) {

where the this$1 is always undefined and cause an exception when trying to replace the router with a new one running this$1.replace(to);
I am not pretty sure if this is a common error when doing rerouting in beforeEach(), or a special case when I do the login through OIDC server and return back to the application then. The callback from OIDC looks fine:

created () {
      .then((redirectPath) => {
      .catch(err => {
        this.$router.push('/signin-oidc-error'); // Handle errors any way you want
        throw err;

This comment has been minimized.

Copy link

@vue-bot vue-bot commented Dec 23, 2019

Hello, thank you for taking time filling this issue!

However, we kindly ask you to use our Issue Helper when creating new issues, in order to ensure every issue provides the necessary information for us to investigate. This explains why your issue has been automatically closed by me (your robot friend!).

I hope to see your helper-created issue very soon!

@vue-bot vue-bot closed this Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.