SupabaseS
Supabaseโ€ข2y ago
cp-sean

Can't get SvelteKit + Supabase Auth Working ๐Ÿ™

I've tried every tutorial I can find including the ones in the official docs. They're all either outdated, don't work, or both. The official docs use the auth-helpers scheme even though the recommended method is to use the newer SSR module. But I can't get that far because the tutorial ends up in a 500 error:
Cannot read properties of undefined (reading 'auth')
    at +layout.svelte:14:16

For some reason the supabase object isn't making into my layout file.

So after several hours of having no fun at all, my question is... Has anyone managed to successfully get SvelteKit working with Supabase Auth? Are there any current/working tutorials out there that I haven't found? Anyone got a recent GitHub showing it working?

I really really want to love Supabase. But so far it's just been a huge bummer. Literally step one of the tutorial fails with this error:
 ~/Sandbox/test ๎‚ฐ npm install @supabase/auth-helpers-sveltekit @supabase/supabase-js
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: test@0.0.1
npm ERR! Found: @sveltejs/kit@2.0.6
npm ERR! node_modules/@sveltejs/kit
npm ERR!   dev @sveltejs/kit@"^2.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @sveltejs/kit@"^1.15.4" from @supabase/auth-helpers-sveltekit@0.10.7
npm ERR! node_modules/@supabase/auth-helpers-sveltekit
npm ERR!   @supabase/auth-helpers-sveltekit@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /Users/sean/.npm/_logs/2023-12-30T00_30_02_174Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /Users/sean/.npm/_logs/2023-12-30T00_30_02_174Z-debug-0.log


Seriously not inspiring much confidence so far.
Was this page helpful?