diff --git a/examples/ssr/src/pages/api/cart.ts b/examples/ssr/src/pages/api/cart.ts index 6aa546903f..2449e0c945 100644 --- a/examples/ssr/src/pages/api/cart.ts +++ b/examples/ssr/src/pages/api/cart.ts @@ -2,7 +2,7 @@ import { APIContext } from 'astro'; import { userCartItems } from '../../models/session'; export function GET({ cookies }: APIContext) { - let userId = cookies.get('user-id').value; + let userId = cookies.get('user-id')?.value; if (!userId || !userCartItems.has(userId)) { return Response.json({ items: [] });