© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
7 replies
John Burger

TypeError: safeGetSession is not a function (SvelteKit)

Why was
import type { LayoutServerLoad } from "./$types";

export const load: LayoutServerLoad = async ({ locals: { session } }) => {
  return {
    session,
  };
};
import type { LayoutServerLoad } from "./$types";

export const load: LayoutServerLoad = async ({ locals: { session } }) => {
  return {
    session,
  };
};


changed to

import type { LayoutServerLoad } from './$types'

export const load: LayoutServerLoad = async ({ locals: { safeGetSession }, cookies }) => {
  const { session } = await safeGetSession()
  return {
    session,
    cookies: cookies.getAll(),
  }
}
import type { LayoutServerLoad } from './$types'

export const load: LayoutServerLoad = async ({ locals: { safeGetSession }, cookies }) => {
  const { session } = await safeGetSession()
  return {
    session,
    cookies: cookies.getAll(),
  }
}


The safeGetSession seems to not work. I copied it step by step from the supabase docs
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

TypeError supabaseServerClient is not a function
SupabaseSSupabase / help-and-questions
4y ago
TypeError: Deno.readFile is not a function
SupabaseSSupabase / help-and-questions
3y ago
TypeError client.auth.getSessionFromUrl is not a function
SupabaseSSupabase / help-and-questions
4y ago
TypeError supabaseClient.auth.session is not a function
SupabaseSSupabase / help-and-questions
4y ago