supabase / auth-helpers

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

Next14 / Supabase SSR - Create Next App With Supabase Build is broken #686

Closed lsbyerley closed 7 months ago

lsbyerley commented 7 months ago

Bug report

Describe the bug

next build does not compile

To Reproduce

Use the create next app with supabase command as mentioned in the blog:

https://supabase.com/blog/supabase-is-now-compatible-with-nextjs-14

npx create-next-app@latest -e with-supabase

Expected behavior

next build should complete without error

Screenshots

Error occurred prerendering page "/login". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useContext')

Error occurred prerendering page "/_not-found". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useContext')

Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useContext')

Error occurred prerendering page "/500". Read more: https://nextjs.org/docs/messages/prerender-error
Error: <Html> should not be imported outside of pages/_document.

Error: <Html> should not be imported outside of pages/_document.
Read more: https://nextjs.org/docs/messages/no-document-import-in-page

Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error
Error: <Html> should not be imported outside of pages/_document.

Export encountered errors on following paths:
    /_error: /404
    /_error: /500
    /_not-found
    /login/page: /login
    /page: /

System information

Additional context

Add any other context about the problem here.

lsbyerley commented 7 months ago

When deploying to vercel, this project does compile successfully with next build. I've provided my machine details, so it seems like this may be a nextjs issue. I'll close this out in case anyone else comes across this