diff --git a/src/app/page.tsx b/src/app/page.tsx index 2e1cdfc1..96e524e8 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -16,7 +16,9 @@ import { MAX_PHOTOS_TO_SHOW_OG } from '@/photo/image-response'; export const runtime = 'edge'; export async function generateMetadata(): Promise { - const photos = await getPhotosCached({ limit: MAX_PHOTOS_TO_SHOW_OG }); + // Make homepage queries resilient to error on first time setup + const photos = await getPhotosCached({ limit: MAX_PHOTOS_TO_SHOW_OG }) + .catch(() => []); return generateOgImageMetaForPhotos(photos); } @@ -27,8 +29,7 @@ export default async function HomePage({ searchParams }: PaginationParams) { photos, count, ] = await Promise.all([ - // Make homepage queries resilient to error - // for initial setup when database may not exist + // Make homepage queries resilient to error on first time setup getPhotosCached({ limit }).catch(() => []), getPhotosCountCached().catch(() => 0), ]); diff --git a/src/site/Footer.tsx b/src/site/Footer.tsx index 1e1ce612..3ab5878f 100644 --- a/src/site/Footer.tsx +++ b/src/site/Footer.tsx @@ -2,7 +2,8 @@ import { authCached } from '@/cache'; import FooterClient from './FooterClient'; export default async function Footer() { - const session = await authCached(); + // Make footer auth resilient to error on first time setup + const session = await authCached().catch(() => null); return ( ); diff --git a/src/site/Nav.tsx b/src/site/Nav.tsx index 684cc5c0..709bb834 100644 --- a/src/site/Nav.tsx +++ b/src/site/Nav.tsx @@ -2,7 +2,8 @@ import { authCached } from '@/cache'; import NavClient from './NavClient'; export default async function Nav() { - const session = await authCached(); + // Make nav auth resilient to error on first time setup + const session = await authCached().catch(() => null); return ( );