Skip to content

Commit 588d8e3

Browse files
khaliqgantclaude
andcommitted
fix(weekly-digest): read BRAVE_API_KEY via env() not process.env
Cloudflare Workers don't expose process.env; env vars come through the binding passed to the Pages Function. OpenRouter already used env(); Brave was the one straggler. Result: every searchWeb call was silently returning [] because the apiKey check failed, hence "quiet week" every run despite Brave actually having results. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 54a88a8 commit 588d8e3

4 files changed

Lines changed: 402 additions & 1 deletion

File tree

agents/weekly-digest/agent.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,9 @@ async function braveSearch(
224224
query: string,
225225
opts: { freshness?: "pd" | "pw" | "pm" | "py"; count?: number } = {},
226226
): Promise<BraveResult[]> {
227-
const apiKey = process.env.BRAVE_API_KEY;
227+
// Workers don't expose `process.env` — env comes through the binding
228+
// passed by the Pages Function and read via env() (same as OpenRouter).
229+
const apiKey = env().BRAVE_API_KEY;
228230
if (!apiKey) {
229231
ctx.logger.warn("BRAVE_API_KEY missing — skipping web search");
230232
return [];

app/page.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { getAllPosts, formatDate } from "@/lib/posts";
33
import { BackgroundOrbs } from "@/components/background-orbs";
44
import { ScrollReveal } from "@/components/scroll-reveal";
55
import { Sparkle } from "@/components/decorations";
6+
import { CardArt, ClockWatcherInbox } from "@/components/card-illustrations";
67
import {
78
jsonLd,
89
websiteSchema,
@@ -297,6 +298,13 @@ export default async function Home() {
297298
</div>
298299
</section>
299300

301+
{/* THE TRIPLE — visual anchor */}
302+
<section className="relative mt-24 sm:mt-32">
303+
<div className="reveal mx-auto max-w-4xl px-6 sm:px-10">
304+
<ClockWatcherInbox />
305+
</div>
306+
</section>
307+
300308
{/* WHY MOST AGENTS ARE STILL REACTIVE */}
301309
<section className="relative mt-32 sm:mt-40">
302310
<div className="mx-auto max-w-5xl px-6 sm:px-10">
@@ -359,6 +367,7 @@ export default async function Home() {
359367
style={{ "--tilt": TILTS[i % TILTS.length] } as React.CSSProperties}
360368
>
361369
<div className="absolute inset-0 bg-gradient-to-br from-white/40 via-transparent to-transparent" />
370+
<CardArt slug={p.slug} />
362371
<div className="absolute inset-0 flex items-end justify-between p-4">
363372
<span className="font-display text-xs uppercase tracking-[0.22em] text-ink/80">
364373
{String(posts.length - i).padStart(2, "0")}

app/posts/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Link from "next/link";
22
import { getAllPosts, formatDate } from "@/lib/posts";
33
import { Asterism, Squiggle, Sparkle } from "@/components/decorations";
4+
import { CardArt } from "@/components/card-illustrations";
45
import { jsonLd, breadcrumbSchema, SITE_URL } from "@/lib/seo";
56

67
export const metadata = {
@@ -70,6 +71,7 @@ export default async function PostsIndex() {
7071
style={{ "--tilt": TILTS[i % TILTS.length] } as React.CSSProperties}
7172
>
7273
<div className="absolute inset-0 bg-gradient-to-br from-white/40 via-transparent to-transparent" />
74+
<CardArt slug={p.slug} />
7375
<div className="absolute inset-0 flex items-end justify-between p-5">
7476
<span className="font-display text-xs uppercase tracking-[0.22em] text-ink/80">
7577
{String(posts.length - i).padStart(2, "0")}

0 commit comments

Comments
 (0)