Skip to content

Commit 9914801

Browse files
committed
fix: include proof.ucan directly in frontend for Vercel pinning
- Copied proof.ucan to frontend/ and frontend/public/ so the SDK finds it at runtime - Added runtime fallback in route.ts to write proof from STORACHA_PROOF env var
1 parent c45ef31 commit 9914801

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

frontend/proof.ucan

2.94 KB
Binary file not shown.

frontend/public/proof.ucan

2.94 KB
Binary file not shown.

frontend/src/app/api/chat/route.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
import { NextResponse } from "next/server";
22
import Groq from "groq-sdk";
33
import { AgentRuntime } from "@arienjain/agent-db";
4+
import { writeFileSync, existsSync } from "fs";
5+
import { join } from "path";
6+
7+
// Write proof.ucan at runtime from env var (for Vercel serverless)
8+
// The SDK reads proof.ucan from process.cwd() to authenticate with Storacha
9+
const proofPath = join(process.cwd(), "proof.ucan");
10+
if (!existsSync(proofPath) && process.env.STORACHA_PROOF) {
11+
try {
12+
writeFileSync(proofPath, Buffer.from(process.env.STORACHA_PROOF, "base64"));
13+
console.log("[Runtime] ✅ Wrote proof.ucan from STORACHA_PROOF env var to", proofPath);
14+
} catch (e) {
15+
console.warn("[Runtime] ⚠️ Could not write proof.ucan:", e);
16+
}
17+
}
418

519
const groq = new Groq({ apiKey: process.env.GROQ_API_KEY || "" });
620

0 commit comments

Comments
 (0)