mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-10-03 05:07:10 +00:00
fix(web): CI E2E — resilient blog/RSS without Supabase + update stale test
The dynamic /blog/rss.xml returned 500 in CI (no Supabase env) and the E2E still asserted the old static feed's hand-written items. - /blog, /blog/[slug], and /blog/rss.xml now degrade gracefully (empty feed/ list, HTTP 200) when Supabase is unavailable, instead of throwing. - E2E: assert the always-present channel <title>LogicSRC Blog</title> and a looser xml content-type, dropping the removed static post titles. Verified with `next dev` and no Supabase env (CI conditions): rss/blog/sitemap all return 200. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
74abf8985f
commit
e47616bf9d
4 changed files with 42 additions and 26 deletions
|
|
@ -20,14 +20,18 @@ type PostRow = {
|
|||
const SITE_URL = (process.env.PUBLIC_URL ?? "https://logicsrc.com").replace(/\/$/, "");
|
||||
|
||||
async function loadPost(slug: string): Promise<PostRow | null> {
|
||||
const supabase = publicClient();
|
||||
const { data } = await supabase
|
||||
.from("blog_posts")
|
||||
.select("slug, title, excerpt, html, featured_image, published_at, updated_at")
|
||||
.eq("slug", slug)
|
||||
.eq("status", "published")
|
||||
.maybeSingle();
|
||||
return (data as PostRow | null) ?? null;
|
||||
try {
|
||||
const supabase = publicClient();
|
||||
const { data } = await supabase
|
||||
.from("blog_posts")
|
||||
.select("slug, title, excerpt, html, featured_image, published_at, updated_at")
|
||||
.eq("slug", slug)
|
||||
.eq("status", "published")
|
||||
.maybeSingle();
|
||||
return (data as PostRow | null) ?? null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function generateMetadata({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue