N
Nuxt3d ago
Ussagui

issue with import { serverSupabaseServiceRole } from "#supabase/server";

"Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'" How can i fix it? With serverSupabaseClient works without any issue ... my envs SUPABASE_URL SUPABASE_KEY SUPABASE_SECRET_KEY
2 Replies
kapa.ai
kapa.ai3d ago
Hi @Ussagui. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- This error is coming from Node’s ESM loader on Windows, not directly from Nuxt. The knowledge sources you provided mention several Windows- and Supabase-related Nuxt issues (build failures, @supabase/postgrest-js CJS vs ESM, etc.), but none of them document a problem or fix specifically for:
import { serverSupabaseServiceRole } from "#supabase/server";
import { serverSupabaseServiceRole } from "#supabase/server";
or for the exact Node error:
Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
The Supabase-related Nuxt issue that is documented is about Vite’s optimizeDeps and CJS modules being sent to the browser, and was fixed by ensuring Vite’s environment plugin runs enforce: 'pre'. [Nuxt issue 33582; fix(vite) PR] That doesn’t match your ESM URL scheme error. Likewise, the Windows issues in the sources are about build problems and Node versions, not about #supabase/server resolution. [Nuxt Windows issue] Because of that, I don’t have a documented, Nuxt-specific fix for this serverSupabaseServiceRole import on Windows in the supplied sources. From the information available, the only clearly documented guidance is: - Nuxt 4.2.0 + @nuxtjs/supabase had some integration problems around module resolution/optimization, which were addressed in Nuxt core (Vite environment plugin changes). [Nuxt issue 33582; fix(vite) PR] - For Supabase in Nuxt 4.1.x, people worked around optimization issues by forcing @supabase/postgrest-js and @supabase/supabase-js into vite.optimizeDeps.include and nitro.externals.inline. [Nuxt issue 33582 comment] However, none of that explicitly covers your serverSupabaseServiceRole + Windows ESM loader error, so I can’t confidently tell you which config change will resolve it based on these sources alone. Given these limitations, the most I can say based on the provided documents is: - Ensure you’re on a Nuxt version that includes the Vite environment fix (the PR explicitly tests with @nuxtjs/supabase). [fix(vite) PR] - If you’re on an earlier 4.1.x, try the documented vite.optimizeDeps.include + nitro.externals.inline workaround for Supabase. [Nuxt issue 33582 comment] Beyond that, the knowledge sources do not contain enough information about serverSupabaseServiceRole on Windows or the “Only URLs with a scheme in…” error to provide a specific, reliable fix. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3d ago
<@231767205581291520> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?