supabase / auth-helpers

A collection of framework specific Auth utilities for working with Supabase.
https://supabase.github.io/auth-helpers/
MIT License
908 stars 232 forks source link

Cannot read properties of undefined (reading 'getSession') #805

Open vednig opened 2 months ago

vednig commented 2 months ago

Bug report

Describe the bug

I am using this template to build my project there are very few auth changes I made nothing major, and I was able to run the project in my server earlier. But after stopping making changes and then running I get image error Which most probably is error with 'supabase-js' or 'auth-helpers-nextjs'.

I tried moving versions as suggested here

Also, viewed the documentation but could find a fix.

I also viewed the supabaseClient class in code but I couldn't find a getSession() in auth

Happening with createServerComponentClient class PS: Documentation suggests there is a getSession. It's most probably a bug.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

Go to 'shedtheshade.com' or Clone the template Enter values,keys Load modules and run project in dev or prod

Expected behavior

Everything was working fine before updating.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

Additional context

 ○ Compiling / ...
 ✓ Compiled / in 18.3s (2356 modules)
⨯ src/app/(dynamic-pages)/layout.tsx (15:33) @ getSession
 ⨯ TypeError: Cannot read properties of undefined (reading 'getSession')
    at fetchSession (layout.tsx:22:68)
    at RootLayout (layout.tsx:38:9)
    at stringify (<anonymous>)
digest: "3794228426"
  13 |     data: { session },
  14 |     error,
> 15 |   } = await supabaseClient.auth.getSession();
     |                                 ^
  16 |
  17 |   if (error) {
  18 |
 ⨯ src/app/(dynamic-pages)/layout.tsx (15:33) @ getSession
 ⨯ TypeError: Cannot read properties of undefined (reading 'getSession')
    at fetchSession (layout.tsx:22:68)
    at RootLayout (layout.tsx:38:9)
    at stringify (<anonymous>)
digest: "3794228426"
  13 |     data: { session },
  14 |     error,
> 15 |   } = await supabaseClient.auth.getSession();
     |                                 ^
  16 |
  17 |   if (error) {
  18 |
GET / 500 in 19214ms