Skip to content

Commit 7891b15

Browse files
committed
fix(content-ingest, scripts): unify on JINA_API_KEY, no more silent free-tier fallback
docker-compose.yml and services/content-ingest/src/jina.ts have always read JINA_API_KEY, but .env.example (and every local .env copied from it) defined JINA_AI_API_KEY — so the paid key never actually reached the container. It degraded gracefully to Jina's free/no-auth tier, so nothing looked broken, but content-ingest has been running on free-tier rate limits since day one, including on the deployed humain-vc instance. scripts/jina-fetch-urls.mjs already carried a comment documenting this exact mismatch as a deliberate workaround; standardized on JINA_API_KEY everywhere instead of routing around it. Production content-ingest on Railway now has JINA_API_KEY set (done directly in the Railway dashboard) and has redeployed successfully. DEPLOYMENT.md's "Known gaps" section updated to drop this entry. Files changed: - .env.example - scripts/jina-fetch-urls.mjs - DEPLOYMENT.md
1 parent 9ef8244 commit 7891b15

3 files changed

Lines changed: 7 additions & 15 deletions

File tree

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
ANTHROPIC_API_KEY=your_api_key_here
44
OPENAI_API_KEY=your_api_key_here
55
PERPLEXITY_API_KEY=your_api_key_here
6-
JINA_AI_API_KEY=your_api_key_here
6+
JINA_API_KEY=your_api_key_here
77
FIRECRAWL_API_KEY=your_api_key_here
88
# Optional for services/social-search. The common-seven social packs default to
99
# the self-hosted SearXNG container (no key needed). Only packs explicitly routed

DEPLOYMENT.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ credential handling).
110110
|---|---|
111111
| `workspace-service` | `NATS_URL` (`nats://${{nats.RAILWAY_PRIVATE_DOMAIN}}:4222`), `CLIENTS_ROOT=/data/clients`, `SESSION_STORE_PATH=/data/sessions.json`, `ID_JWKS_URL`, `ID_ISSUER`, `DIDI_AUTH=required`, `REQUIRED_ORG_ID=humain.vc`, `ACTIVE_CLIENT_ID=humain-vc`, `PORT=3001` (see gotcha below) |
112112
| `record-surrealdb-resolver` | `NATS_URL`, `SURREAL_URL`, `SURREAL_NS`, `SURREAL_DB`, `SURREAL_USER`, `SURREAL_PASS` |
113-
| `content-ingest` | `NATS_URL`, `CLIENTS_ROOT=/clients`, `JINA_API_KEY` (**not currently set** — see [Known gaps](#known-gaps)) |
113+
| `content-ingest` | `NATS_URL`, `CLIENTS_ROOT=/clients`, `JINA_API_KEY` (paid-tier extraction) |
114114
| `prompt-runner` | `NATS_URL`, `ANTHROPIC_API_KEY` |
115115
| `shell` | `PUBLIC_WS_URL=wss://ws.augment.didi.sh/ws`, `PUBLIC_ID_BASE=https://id.didi.sh`, `PUBLIC_STRATEGY_CURATOR_REMOTE`, `PUBLIC_CHAT_REMOTE` (all build-time — baked in via Docker `ARG`/`ENV`, not read at runtime) |
116116
| `strategy-curator` | `PUBLIC_WS_URL`, `PUBLIC_STRATEGY_CURATOR_ASSET_PREFIX` (build-time) |
@@ -220,14 +220,6 @@ keyed by ID).
220220

221221
## Known gaps
222222

223-
- **`JINA_API_KEY` naming mismatch.** `.env.example` and this repo's local
224-
`.env` both define `JINA_AI_API_KEY`; `services/content-ingest/src/jina.ts`
225-
actually reads `process.env.JINA_API_KEY` (no "AI"). Degrades gracefully
226-
to Jina's free/no-auth tier when unset, so nothing has visibly broken —
227-
but the deployed `content-ingest` is running on the free tier's rate
228-
limits as a result. Either rename the var everywhere for consistency, or
229-
set `JINA_API_KEY` (the name the code actually reads) on Railway with the
230-
real key value.
231223
- **Corpus sync / backup.** The corpus lives on a single Railway Volume
232224
with no automated backup or sync-to-laptop story yet — the original plan
233225
assumed a DO box's filesystem an rclone cron job could reach directly,

scripts/jina-fetch-urls.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// node scripts/jina-fetch-urls.mjs # uses the MANIFEST below
1313
// node scripts/jina-fetch-urls.mjs --dry-run # fetch + report, write nothing
1414
//
15-
// Reads JINA_AI_API_KEY from augment-it/.env (Jina paid tier; the service
16-
// reads JINA_API_KEY in-container, but the committed .env var is JINA_AI_API_KEY).
15+
// Reads JINA_API_KEY from augment-it/.env (Jina paid tier — same var name
16+
// services/content-ingest/src/jina.ts reads in-container).
1717

1818
import { readFile, writeFile, mkdir, readdir } from 'node:fs/promises';
1919
import { join, dirname } from 'node:path';
@@ -55,10 +55,10 @@ const MANIFEST = [
5555
// this exact reach.edu URL (caught by the exact_url dedupe).
5656

5757
async function loadJinaKey() {
58-
if (process.env.JINA_AI_API_KEY) return process.env.JINA_AI_API_KEY;
58+
if (process.env.JINA_API_KEY) return process.env.JINA_API_KEY;
5959
try {
6060
const env = await readFile(join(REPO_ROOT, '.env'), 'utf8');
61-
const m = env.match(/^JINA_AI_API_KEY=(.+)$/m);
61+
const m = env.match(/^JINA_API_KEY=(.+)$/m);
6262
if (m) return m[1].trim().replace(/^["']|["']$/g, '');
6363
} catch {}
6464
return null;
@@ -179,7 +179,7 @@ function buildFrontmatter(item, r) {
179179

180180
async function main() {
181181
const key = await loadJinaKey();
182-
if (!key) console.warn('⚠ No JINA_AI_API_KEY found — trying free tier (lower rate limits).');
182+
if (!key) console.warn('⚠ No JINA_API_KEY found — trying free tier (lower rate limits).');
183183
const seen = await existingUrls();
184184
let written = 0, skipped = 0, failed = 0;
185185

0 commit comments

Comments
 (0)