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

Client-side middlewares don't work #55

Closed
Tracked by #480
tobiasdiez opened this issue Nov 11, 2021 · 8 comments
Closed
Tracked by #480

Client-side middlewares don't work #55

tobiasdiez opened this issue Nov 11, 2021 · 8 comments
Labels
bug Something isn't working needs reproduction

Comments

@tobiasdiez
Copy link
Contributor

Environment

  • Operating System: Windows_NT
  • Node Version: v17.0.1
  • Nuxt Version: 2.16.0-27273615.ab1c6cb4
  • Package Manager: yarn@1.22.15
  • Bundler: Webpack
  • User Config: target, bridge, vite, alias, nitro, ssr, head, css, plugins, components, tailwindcss, buildModules, modules, serverMiddleware, watch, privateRuntimeConfig, build, storybook
  • Runtime Modules: -
  • Build Modules: @nuxtjs/tailwindcss@4.2.1, portal-vue/nuxt, @nuxt/postcss8@1.1.3, @pinia/nuxt@0.1.0, @nuxt/bridge@3.0.0-27276275.abfbd2f

Describe the bug

Having a page with middleware: ['test'] and an (empty) middleware in middleware/test.ts, you get an error on loading the page that the middleware 'test' is not found one page load.

This has been reported before in some way or another:
https://github.com/nuxt/framework/discussions/973
https://github.com/nuxt/framework/discussions/906

Reproduction

JabRef/JabRefOnline#480
Reenable the middleware comment in dasboard.vue and run yarn dev.

Additional context

No response

Logs

No response

@tobiasdiez tobiasdiez added bridge bug Something isn't working labels Nov 11, 2021
@Rigo-m
Copy link
Contributor

Rigo-m commented Nov 12, 2021

Are client side middlewares supported on nuxt 3? Because there are no docs for them.

I guess you can use a defered call via asyncData in the layout to act as a client side middleware?

@wobsoriano
Copy link
Member

@danielroe
Copy link
Member

I can't reproduce this on Nuxt Bridge. Would you provide a minimal reproduction please? 🙏

@danielmalmros
Copy link

Hi @danielroe
I have the same issue using a fresh Nuxt 3 setup.

  • Nuxt 3 version: ^3.0.0-27338323.1e98259

Folder setup:

  • middleware
    • auth.ts

Nuxt config:

import { defineNuxtConfig } from "nuxt3";

export default defineNuxtConfig({
  router: {
    middleware: ["auth"],
  },
});

I'm expecting it to run on every route.
btw. it would be nice with some documentation about client middleware on the new Nuxt 3 site - it's kinda essential to many projects :)

@danielroe
Copy link
Member

@danielmalmros This issue is about Bridge. Nuxt 3 middleware support is in progress.

@calebwaldner
Copy link

calebwaldner commented Jan 9, 2022

@danielmalmros This issue is about Bridge. Nuxt 3 middleware support is in progress.

@danielroe Just checking in so I'm 100% clear on this, can we expect to get client-side middleware support with Nuxt 3 (not Bridge)? You say 'in progress' which leads me to believe Nuxt 3 will have middleware similar to Nuxt 2; I wanted to double-check that this is the case. Thanks!

@calebwaldner
Copy link

Just an update for closure, looks like clientside middleware has been added. Check it out

@danielroe
Copy link
Member

@tobiasdiez Are you still experiencing this issue?

@danielroe danielroe transferred this issue from nuxt/framework Apr 13, 2022
@danielroe danielroe removed the bridge label Apr 13, 2022
@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Jul 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs reproduction
Projects
None yet
Development

No branches or pull requests

6 participants