atinux / nuxt-auth-utils

Add Authentication to Nuxt applications with secured & sealed cookies sessions.
MIT License
962 stars 90 forks source link

getting oauthGoogleEventHandler is not defined while using in a layer #185

Closed geminigeek closed 1 month ago

geminigeek commented 1 month ago

hi,

i am using this in a layer , if i put the server endpoint in main layer it works if i shift it to a child layer it throws this error


mainLayer 
./server/routes/auth/social/google.js ( this works )

mainLayer 
./layers/auth/server/routes/auth/social/google.js ( this throws this error)

 WARN  [Vue Router warn]: No match found for location with path "/auth/social/google"

 ERROR  [nuxt] [request error] [unhandled] [500] oauthGoogleEventHandler is not defined
  at ./layers/auth/server/routes/auth/social/google.js:1:1
  at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
  at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
  at async ./node_modules/h3/dist/index.mjs:1975:19
  at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)
  at async Server.toNodeHandle (./node_modules/h3/dist/index.mjs:2266:7)
atinux commented 1 month ago

I tested locally and works great though, do you mind sharing a Stackblitz?

geminigeek commented 1 month ago

hi,

it seems i am making routes with .js ,this is causing this issue , i changed the file to .ts, every thing works

i opened an issue in nuxt https://github.com/nuxt/nuxt/issues/29120