Skip to content

globalAppMiddleware: true raises infinite redirection #1052

@agracia-foticos

Description

@agracia-foticos

Environment

Reproduction

Describe the bug

We have in my project globalAppMiddleware: true

If we set to true, in logs
[Vue Router warn]: Detected a possibly infinite redirection in a navigation guard when going from "/" to "/". Aborting to avoid a Stack Overflow.
Are you always returning a new location within a navigation guard? That would lead to this error. Only return when redirecting or aborting, that should fix this. This might break in production if not fixed.

If we remove it, error disappears

My nuxt.config.ts
auth: {

    isEnabled: true, //all environment variables are strings
    baseURL: `${process.env.NUXT_BASE_URL}/api/auth`, 

    globalAppMiddleware: true, pages: { signIn: '/login' }, 
    provider: { type: 'authjs' },
    sessionRefresh: {
        enablePeriodically: 86400000, //refresh the session every day
        enableOnWindowFocus: true,
    },
},

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA bug that needs to be resolvedp4Important Issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions