© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
6 replies
yeehawlerz101

Supabase Fetch Count Returns Null

I'm using svelteKit (after the reactor) and I'm trying to get a count of my total entries in my table. here is the code:
export default async function load(){
let { data: count, error } = await supabase
  .from('smsspam')
// My table is named smsspam
  .select('*', { count: 'planned', head: true })
// selecting all entries in the table and counting them, using head because I only want the count.
//the results should look like:
// {"count": 3,"status": 200, "statusText": "OK" } but returns null.
  console.log("Total Rows",count)
  if (error) {
console.log(error.message);
}
return {
props:{count}
};
}
export default async function load(){
let { data: count, error } = await supabase
  .from('smsspam')
// My table is named smsspam
  .select('*', { count: 'planned', head: true })
// selecting all entries in the table and counting them, using head because I only want the count.
//the results should look like:
// {"count": 3,"status": 200, "statusText": "OK" } but returns null.
  console.log("Total Rows",count)
  if (error) {
console.log(error.message);
}
return {
props:{count}
};
}
Capture.PNG
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

supabase auth.getUser always returns null
SupabaseSSupabase / help-and-questions
4y ago
Next.js Supabase example fails with local Supabase instance (middleware returns null)
SupabaseSSupabase / help-and-questions
4mo ago
Database Function returns null
SupabaseSSupabase / help-and-questions
4y ago
Supabase fetch issue
SupabaseSSupabase / help-and-questions
4y ago