Skip to content

nuxt-auth-utils throws Unauthorized (/api/_auth/session) on any 404 page #115

@cosbgn

Description

@cosbgn

I added sentry to my project and within days I had hundreds and hundreds of Unauthorized errors coming up.
After investigating I arrived to the conclusion that:

nuxt-auth-utils throws `Unauthorized (/api/_auth/session)` on any 404 page

So since bots scan for /wp-admin etc I get a ton of these.
This is a small reproduction (create a nitro plugin):

// server/plugins/server_error_handler.js

export default defineNitroPlugin((nitroApp) => {
    nitroApp.hooks.hook('error', (err, context) => {
        console.error(`${err?.message || "Server Error"} (${context?.event?.path})
    }
})

Open any 404 page like /api/does-not-exists or even client pages like /does-not-exists

The console will show:

 ERROR  Unauthorized (/api/_auth/session)

Not sure why this is happening but it doesn't seem like a normal behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions