nuxt / nuxt/bridge

Nuxt Bridge Middleware Chain Not Breaking on navigateTo(), abortNavigation()

Open
#1,101 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
285
Forks
33
Avg merge
22h 38m
Merged PRs (30d)
3

Description

Environment
  • Operating System: Darwin
  • Node Version: v18.17.1
  • Nuxt Version: 2.17.2
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: npm@9.6.7
  • Builder: webpack
  • User Config: bridge, router, serverHandlers, devServerHandlers, devServer, typescript, nitro, buildModules
  • Runtime Modules: -
  • Build Modules: (), @nuxt/bridge@3.0.1-28452354.e299e14
Reproduction

Reproduction repo: https://github.com/atomiomi/nuxt-bridge-middlewares
The repo has README with steps to reproduce

Describe the bug

In Nuxt Bridge, when a middleware uses the navigateTo(), abortNavigation() utility to redirect the user, the middleware chain does not break as expected. This behavior results in subsequent middlewares being called, potentially leading to errors. This issue is particularly problematic in scenarios where a root middleware checks for user authentication and attempts to block access to a page.

Additional context

No response

Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction repository and follow its README steps to observe the middleware chain around navigateTo() and abortNavigation(). Trace the Nuxt Bridge middleware entry point involved in navigation, then add or update coverage showing that redirecting or aborting stops subsequent middleware from running.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxtjs, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.