Skip to content

Impossible to check null session without getSession warning #1707

@jdgamble555

Description

@jdgamble555

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

This is an auth.js issue related to supabase/auth-js#873, so I'm not going to link the other repos.

It is IMPOSSIBLE to check for a session without contacting the Supabase server or displaying the annoying warning.

To be more specific, if my session is NULL, there is NO reason for me to need to contact the Supabase server. This means, for my pages that don't require a login, it will ALWAYS contact the Supabase server needlessly.

The problem lies in the suppressGetSessionWarning can only be called when the _saveSession gets called. What if there is no session? Then we have to use getUser() for no reason, or deal with a needless warning OVER and OVER.

To Reproduce

Check a user's session with getSession() while not logged in, you get the warning.

Expected behavior

It is expected that we can use getSession() without a warning. The warning only shows up when there is a session and we can use getSession() without calling getUser().

Other Problems

This has been mentioned in all three github issues, but still not solved.

Please do not close this issue until both the NextJS and SvelteKit (preferably all docs) have been updated to NOT only use getUser() on the server for NULL.

Adding an extra needless fetch is a big deal.

J

Metadata

Metadata

Assignees

No one assigned

    Labels

    auth-jsRelated to the auth-js library.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions