potato4d / nuxt-basic-auth-module

Provide basic auth your Nuxt.js application
https://www.npmjs.com/package/nuxt-basic-auth-module
MIT License
311 stars 9 forks source link

Not working with nuxt3 #234

Open cmmata opened 2 years ago

cmmata commented 2 years ago

Hi!

I am having an error when trying to get this plugin to work with Nuxt3. Should be working, or is this plugin only intended to run with Nuxt2?

ℹ Register basic auth module to server middleware  

 ERROR  Cannot start nuxt:  Cannot read properties of undefined (reading 'handle')                                                                                                              

  at Function.use (node_modules/connect/index.js:87:21)
  at Object.set [as setLegacyMiddleware] (node_modules/@nuxt/nitro/dist/index.mjs:1875:13)
  at node_modules/nuxt3/dist/index.mjs:852:17
  at async initNuxt (node_modules/nuxt3/dist/index.mjs:945:3)
  at async load (node_modules/nuxi/dist/chunks/dev.mjs:6717:9)
  at async Object.invoke (node_modules/nuxi/dist/chunks/dev.mjs:6756:5)
  at async _main (node_modules/nuxi/dist/chunks/index.mjs:384:7)

This is my nuxt.config.js

export default defineNuxtConfig({
  modules: [
    [
      'nuxt-basic-auth-module'
    ]
  ],
  alias: {
    images: resolve(__dirname, './public/images')
  },
  vite: {
    build: {
      chunkSizeWarningLimit: 1000
    }
  },
  basic: {
    name: 'AUTH USER NAME HERE',
    pass: 'AUTH PASSWORD HERE',
    enabled: 'true' // require boolean value(nullable)
  },
})
Intevel commented 2 years ago

Hey, currently the module only supports Nuxt 2.

cmmata commented 2 years ago

Hey, currently the module only supports Nuxt 2.

I see... And is there any plan to support Nuxt3? Obviously no need for deadlines, only intentions.

Intevel commented 2 years ago

Currently I don't know anything about plans from the module maintainer regarding Nuxt 3. However, the module is used by many and it would make sense to make it Nuxt 3 compatible. I'll take a look at it & try my best.

degoya commented 1 year ago

any news on nuxt3 support?

Intevel commented 1 year ago

There is an module like this with Nuxt 3 Support https://github.com/xtranophilist/nuxt-basic-auth