supabase
supabase copied to clipboard
Nuxt3 api/me route cannot resolve import from '#supabase/server'
Hi, I'm having typescript error saying that cannot find module in "#supabase/server" even tho everything works fine, it's just that error. Tried in VS Code, Nvim and got same error. For now i use // @ts-ignore for that part but it's just so I can find fix for it. Anybody know how to fix this?
Version
@nuxtjs/supabase: v0.3.7 nuxt: v3.5.3
Steps to reproduce
Create server/api/me.ts and try to import serverSupabaseUser without typescript error
What is Expected?
Typescript should be able to import and show types for serverSupabaseUser when importing.
What is actually happening?
Typescript is throwing error that it cannot find module or declaration in #supabase/server as shown in image above.
@ASoldo I'm getting the same thing. I think it's something to do with how VSCode is resolving the generated types in .nuxt/types/supabase.d.ts
as the typescript compiler doesn't seem to have an issues with it.
My hack is a little more tolerable than @ts-ignore
. I simply copied the type defs to server/types.d.ts
. Unfortunately I wasn't able to find the root issue in the time I have.
declare module "#supabase/server" {
const serverSupabaseClient: typeof import("../node_modules/@nuxtjs/supabase/dist/runtime/server/services").serverSupabaseClient;
const serverSupabaseServiceRole: typeof import("../node_modules/@nuxtjs/supabase/dist/runtime/server/services").serverSupabaseServiceRole;
const serverSupabaseUser: typeof import("../node_modules/@nuxtjs/supabase/dist/runtime/server/services").serverSupabaseUser;
}
I also get the same issue. Any idea to solve this issue?