nuxt-alt / auth

An alternative module to @nuxtjs/auth
https://nuxt-alt-auth.vercel.app/
MIT License
113 stars 20 forks source link

Cannot find module 'local' #54

Closed rashidpathiyil closed 1 year ago

rashidpathiyil commented 1 year ago

Environment

npx nuxi info
Nuxi 3.5.0                                                                           

RootDir: /Users/rashidpathiyil/Sites/nuxt-app                                    
Nuxt project info: (copied to clipboard)                                                                 

------------------------------
- Operating System: Darwin
- Node Version:     v18.16.0
- Nuxt Version:     3.5.0
- Nitro Version:    2.4.1
- Package Manager:  pnpm@8.5.1
- Builder:          vite
- User Config:      modules, experimental, runtimeConfig, image, tailwindcss, proxy, auth, app
- Runtime Modules:  @nuxtjs/tailwindcss@6.7.0, @nuxt-alt/auth@2.5.0, @nuxt-alt/proxy@2.2.3, @pinia/nuxt@0.4.10, @pinia-plugin-persistedstate/nuxt@1.1.1, @vueuse/nuxt@10.1.2, nuxt-icon@0.4.0, @nuxt/image-edge@1.0.0-28008586.381b906

Nuxt Config

  modules: [
    '@nuxtjs/tailwindcss',
    '@nuxt-alt/auth',
    '@nuxt-alt/proxy',
    '@pinia/nuxt',
    '@pinia-plugin-persistedstate/nuxt',
    '@vueuse/nuxt',
    'nuxt-icon',
    '@nuxt/image-edge',
  ],
  })

Reproduction

-

Describe the bug

Error In Terminal

ERROR  Error while requiring module local: Error: Cannot find module 'local'      
Require stack:
- /Users/rashidpathiyil/Sites/nuxt-app/index.js

After Upgraded to:

nuxt-alt/auth: 2.5.0
nuxt-alt/http: 1.6.4

Upgraded From.

nuxt-alt/auth: 2.2.0,
nuxt-alt/http: 1.5.7

Using Nuxt@3.5.0

Additional context

No response

Logs

No response

RadBe commented 1 year ago

same problem nuxt 3.5.0 change @nuxt/kit in this commit

RadBe commented 1 year ago

I use "refresh" scheme. I just changed the strategy to the existing one "auth0" and set "refresh" scheme. This works as a temporary fix.

auth: {
  strategies: {
    auth0: {
      scheme: 'refresh',
      .....
januarfonti commented 1 year ago

same issue here

szadave commented 1 year ago

+1 here

ftrsoft commented 1 year ago

I got this error when I upgraded nuxt to version 3.5.0 I just installed the module: npm install local

Denoder commented 1 year ago

Possibly has to do with this: https://github.com/nuxt/nuxt/issues/20883 I'd suggest sticking with something below 3.5 til they update so I can see if I need to make some updates.

rashidpathiyil commented 1 year ago

Possibly has to do with this: https://github.com/nuxt/nuxt/issues/20883

https://github.com/nuxt/nuxt/issues/20883 is closed in Nuxt 3.5.1 but the issue is still there.☹️ @Teranode

steklopod commented 1 year ago

+1 with nuxt nuxt 3.4.3 & 3.5.1

Снимок экрана 2023-05-24 в 17 43 15 Снимок экрана 2023-05-24 в 17 36 49
steklopod commented 1 year ago

I use "refresh" scheme. I just changed the strategy to the existing one "auth0" and set "refresh" scheme. This works as a temporary fix.

auth: {
  strategies: {
    auth0: {
      scheme: 'refresh',
      .....

Also did like this but it will attach scope: string[] field to request. After configuring the backend to not to fail when meeting unknown properties login started to work

IlyaSemenov commented 1 year ago

I made some research and here are my observations:

1) The error message doesn't affect anything. Authentication works normally both in dev build and in production build.

2) The problem was always there! The only difference between Nuxt 3.5 and 3.4 is that 3.4 printed no warning message for a failed import—but it was crashing the same way. If you add console.log into this catch block if you will see all sort of errors importing local, cookie, refresh, etc.: https://github.com/nuxt-alt/auth/blob/23028d60e561ea2a97ae904e095733a92e43b54f/src/resolve.ts#L120-L125

3) I came up with this simple hack/workaround to silence the error:


export default defineNuxtConfig({
  auth: {
    strategies: {
      refresh: {
        // Silence nuxt-auth error, see https://github.com/nuxt-alt/auth/issues/54
        provider: () => {},
      },
    },
  },   
})
IlyaSemenov commented 1 year ago

@Teranode Is that essential to bump dependencies to "@nuxt/kit": "^3.6.1"? Will the module not work in Nuxt 3.4.x? At first glance it seems there is no code in the patch that depends on 3.6.

The reason I'm asking is because I can't upgrade to Nuxt 3.5 as it introduced some breaking regressions (e.g. https://github.com/nuxt/nuxt/issues/21417). Now I can't upgrade @nuxt-alt/auth either.

steklopod commented 1 year ago

@IlyaSemenov looks like the project is dead and someone need to fork this module

Denoder commented 1 year ago

@Teranode Is that essential to bump dependencies to "@nuxt/kit": "^3.6.1"? Will the module not work in Nuxt 3.4.x? At first glance it seems there is no code in the patch that depends on 3.6.

The reason I'm asking is because I can't upgrade to Nuxt 3.5 as it introduced some breaking regressions (e.g. nuxt/nuxt#21417). Now I can't upgrade @nuxt-alt/auth either.

Hmm, I usually bump things up because there's usually something that breaks when going back a minor version, I'll change it.

Denoder commented 1 year ago

@IlyaSemenov looks like the project is dead and someone need to fork this module

It's not dead, I've just been really busy and was taking a long time off development. I'm back now though.

Denoder commented 1 year ago

@Teranode Is that essential to bump dependencies to "@nuxt/kit": "^3.6.1"? Will the module not work in Nuxt 3.4.x? At first glance it seems there is no code in the patch that depends on 3.6.

The reason I'm asking is because I can't upgrade to Nuxt 3.5 as it introduced some breaking regressions (e.g. nuxt/nuxt#21417). Now I can't upgrade @nuxt-alt/auth either.

try updating to 2.5.2