-
Notifications
You must be signed in to change notification settings - Fork 7
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
Server modules not getting auto-imported #2
Comments
Hey @juni0r ; thanks for reporting the issue! I just published 0.0.9 that uses raw imports in That should avoid this kind of issue! Would you mind keeping me updated on this, I'm very happy you are planning on using the module! |
Hey @Tahul, thanks again for the swift release! I'm afraid you've missed a few instances, like this one: nuxt-edgedb/src/runtime/api/auth/signup.ts Lines 10 to 11 in 0924259
I'm also getting an 'unknown path' error from the auth server when using |
Hey @juni0r ; I should have fixed the issue with The fix is released under |
Lines 450 to 453 in f3b4fd5
Here is the part of the. code that injects I don't see why, if If needed, you can try to debug it by injecting the routes on your own by doing that: import { createResolver, addServerHandler } from '@nuxt/kit'
const { resolve } = createResolver(import.meta.url)
export default defineNuxtConfig({
modules: [
function (nuxt) {
addServerHandler({
handler: resolve('./node_modules/nuxt-edgedb-module/dist/runtime/api/login'),
route: '/api/auth/login',
})
}
]
}) That should inject the route and let you debug it. You can also copy the content of that route to another file and map it the same way to go further. Let me know if I can help any further, and do not hesitate to provide a reproduction, I would happily go through it! |
The server route is available. It contacts the edgedb auth server which returns 'path not found'. I tried to investigate further, but I'm still struggling to run the module playground. From a quick glance at the code, I noticed that the auth server URL is built differently from what's in the docs:
The Lines 433 to 434 in f3b4fd5
However, the default value for the auth URL does include
|
Damn, good catch @juni0r I just fixed it in |
I got the playground running but I had to install a few packages in the playground project and even one in the root project. These were all dependencies of It might be a consideration to remove I also looked at the import paths again and I would suggest to use a path alias for the server module, such as If you would like to have a look at my changes, I'd be happy to send you a PR. |
I would love to see your PR. I just updated the aliases paths to be consistent (0.0.13). Totally agree with you on the I first built the playground using I think we would be better with a very minimal playground, built on top of PicoCSS or any other 1-liner CSS framework. |
After doing a clean install of the playground, it suddenly worked without issues. Must have been a glitch in my installation. So it turns out I submitted the PR yesterday. It's nice how it fits with the aliases you've added in the meantime. |
When using auth api handlers (such as login) fails due to server modules not being auto-imported. Reproduction repo.
nuxt-edgedb/src/runtime/api/auth/login.ts
Lines 2 to 6 in b8338ed
The modules in
src/runtime/server
should be auto-imported since the module adds them to Nitro's import paths, but apparently something goes wrong. I'd love to investigate further but I'm not too familiar with Nuxt 3 modules yet. I suspect it's to do with the import folder containing.mjs
files instead of.ts
.The text was updated successfully, but these errors were encountered: