Should support `output=hybrid` + `prerender=false`?
Of course the page that uses getSession should be SSR. But it seems that output=hybrid with export const prerender=false on the every page that uses auth-astro still leads to the following error (when you login or logout - i.e. when you use auth endpoints):
Which I guess I understand why - auth-astro need to inject those auth endpoints but in hybrid mode then are by default SSG which they shouldn't. Putting export const prerender=false on the app pages do not really change anything as they don't affect the endpoint pages - at least that's my understanding.
It is annoying, because the majority of my pages are SSG and only a few pages are SSR and they needs user to login and view. I am doing ok by switching output=server and putting export const prerender=true to all SSG pages (opt in instead of opt out) but I wonder if there is a better workaround / built-in support.
A workaround for this is to set injectEndpoints: false in the auth-astro integration config.
Then, create your own src/pages/api/[...auth].ts with the following:
import { AstroAuth } from "auth-astro/server";
export const prerender = false;
export const { GET, POST } = AstroAuth();
This is the same code that auth-astro injects but with the export const prerender = false; line.
Hi, thanks for bringing this to my attention. I´ll include
export const prerender = false;
with the next patch, like @MiniCheese26 suggested.