I am using AstroJS in "server" mode with NodeJS (everything at the latest version) and have this weird issue with only one SSR route.
My route /oauth2/employee/callback accepts a queryparam code and is meant to used as an oauth2 callback.
When i call the route WITH the code param, the page is called successfully, but will still return a 404 status in the network console, as well in local mode: 12:11:24 [404] /oauth2/employee/callback 401ms
When i call the route WITHOUT the code param, i get the browsers default HTTP ERROR 404 page.
Both behaviours dont make sense to me - return a 404 status while rendering succesfully is as confusing as getting the browsers 404 page instead of Astros default 404.
Heres my code of that page, maybe some of you guys experienced something similar:
---
import ...
const code = Astro.url.searchParams.get('code')
const context = i18nConfig.toAstroLanguageContext(Astro);
if (!code) {
return Astro.redirect(context.toLanguagePath(paths.account.login.index))
}
try {
await API.backend.administration.oauth2.login(Astro, code!);
} catch (e) {
props.state = undefined;
props.error = e
}
---
<Layout>
<ErrorBoundary error={props.error}>
<ContentContainer>
<div class="flex flex-col justify-center items-center my-10 mx-auto">
<div>Logged In!</div>
</div>
</ContentContainer>
</ErrorBoundary>
</Layout>