-
-
Notifications
You must be signed in to change notification settings - Fork 176
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
Getting a Nuxt WARN
while defining local middleware for pages protection
#892
Comments
me too |
Can you share a bit more details about your setup? Ideally, providing a reproduction using stackblitz |
Hello 👋 Please provide a reproduction for this issue 🙏 How can I create a reproduction?Please use one of the following links to reproduce your issue.
Please ensure that the reproduction is as minimal as possible. This will allow us to isolate the issue as best as possible. Here are some more amazing posts about the importance of reproductions: |
Hi @phoenix-ru, So, the only thing I can tell you is that I am using a Strapi backend, with this @sidebase/nuxt-auth configuration : auth: {
globalAppMiddleware: false,
baseURL: process.env.BACKEND_URL + "/api/",
provider: {
type: "local",
endpoints: {
signOut: false,
signIn: { path: "auth/local", method: "post" },
signUp: { path: "auth/local/register", method: "post" },
getSession: { path: "users/me", method: "get" },
},
token: {
signInResponseTokenPointer: "/jwt",
type: "Bearer",
cookieName: "auth.token",
headerName: "Authorization",
maxAgeInSeconds: 30 * 24 * 3600,
sameSiteAttribute: "lax",
httpOnlyCookieAttribute: false,
},
pages: {
login: "/auth/login",
},
},
}, And on every page I put this, I have the same number of a set of two definePageMeta({
middleware: 'auth'
}) Thanks for your help! |
Hi @maximehamou , thanks for the minimal example! You can also create reproductions as GH repository - the only requirement for a repro is that it is public and we can actually run the code and reproduce the issue Unfortunately, as we are a bit swarmed with other work at the moment, I have to lower the priority of it a bit - but it is always encouraged to investigate yourself and propose fixes. Thanks for the understanding 🙂 |
Hi @maximehamou 👋 I took a few minutes and tried to reproduce your error, but was sadly unsuccessful. Feel free to fork my branch and see if you can manage to reproduce the error in my minimal setup. https://github.com/zoey-kaiser/nuxt-auth-reproductions/tree/892/investigate-middleware-warning |
the filename of the middleware seems to matter. this produces the warning
this doesnt
|
This makes more sense! Even if our middleware is disabled, it still gets loaded into the Nuxt App. Therefore you cannot use the name naming as our auth middleware. However, I think that we should rename our middleware to |
Environment
Darwin
v18.18.2
3.12.3
3.12.0
2.9.7
[email protected]
-
ssr
,app
,css
,runtimeConfig
,modules
,apiParty
,auth
,plugins
,components
,build
,devServer
,compatibilityDate
[email protected]
,@sidebase/[email protected]
-
Reproduction
Disable global middleware and add those lines in the setup script of the Vue page :
Describe the bug
I have multiple times this two
WARN
in my terminal since I have installed and set up@sidebase/nuxt-auth
, every time I save a Vue file :I am using the local middleware, and defining it this way :
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: