koala73/worldmonitor · critical · Error
[backfillCanary250] RESEND_API_KEY not set — run with the sa
Error message
[backfillCanary250] RESEND_API_KEY not set — run with the same env that hosts the canary segment.
What it means
Thrown by the backfillCanary250 internal action when process.env.RESEND_API_KEY is unset. The action pages Resend's contact-listing API to stamp prior canary-wave rows, so it must run in an environment that has the Resend API key configured — the same env that hosts the canary segment.
Source
Thrown at convex/broadcast/backfillCanaryWaveStamps.ts:128
* Page Resend's `GET /contacts?segment_id=...` with cursor pagination
* (`after=<contact-id>`) until exhausted, calling
* `_stampWaveByNormalizedEmail` for each contact's email.
*
* Convex action time limit is 10 minutes; at ~244 contacts and one
* Resend GET per ~100 plus one Convex mutation per contact, this
* comfortably fits in well under a minute.
*
* All Resend addresses are normalized via the same `trim().toLowerCase()`
* convention used at every write site — must match
* `registrations.normalizedEmail` semantics or the join would silently
* miss rows.
*/
export const backfillCanary250 = internalAction({
args: {},
handler: async (ctx): Promise<BackfillStats> => {
const apiKey = process.env.RESEND_API_KEY;
if (!apiKey) {
throw new Error(
"[backfillCanary250] RESEND_API_KEY not set — run with the same env that hosts the canary segment.",
);
}
if (!Number.isFinite(CANARY_SENT_AT_MS)) {
throw new Error(
"[backfillCanary250] CANARY_SENT_AT_MS failed Date.parse — check the literal.",
);
}
const stats: BackfillStats = {
fetched: 0,
stamped: 0,
alreadyStamped: 0,
notFound: 0,
failed: 0,
};
View on GitHub (pinned to ffec79ac33)
Solutions
- Set RESEND_API_KEY in the Convex deployment environment: `npx convex env set RESEND_API_KEY=<value>`.
- For local runs, ensure .env.local (or the local Convex env) has RESEND_API_KEY.
- Confirm the key value matches the Resend account that hosts the canary segment.
Example fix
// before — env missing
await backfillCanary250(ctx, {}); // RESEND_API_KEY not set
// after — set env in Convex deployment first
// $ npx convex env set RESEND_API_KEY re_xxx
await backfillCanary250(ctx, {}); Defensive patterns
Strategy: validation
Validate before calling
if (!process.env.RESEND_API_KEY) {
throw new Error("Set RESEND_API_KEY in the Convex env before running backfillCanary250");
}
await backfillCanary250(ctx, {}); Prevention
- Set RESEND_API_KEY via `npx convex env set` in every deployment environment that runs backfills.
- Document the env requirement in the runbook for canary backfills.
- Verify env presence in a preflight check before invoking the action.
When it happens
Trigger: Invoking backfillCanary250 in an environment (local dev, CI, a fresh Convex deployment) where the RESEND_API_KEY environment variable is not set; running the backfill in a context that does not share env with the production Resend integration.
Common situations: Developer ran the action locally without .env.local; Convex env vars not propagated to the deployment; a new staging environment missing the Resend key; the key was rotated and the new value not deployed.
Related errors
- [backfillCanary250] CANARY_SENT_AT_MS failed Date.parse — ch
- [backfillCanary250] Resend list-contacts ${res.status}: ${bo
- [backfillCanary250] unexpected Resend response shape: ${JSON
- [assignAndExportWave] waveLabel "${waveLabel}" already has s
- [assignAndExportWave] pool empty — all registrations are sup
AI-assisted analysis of koala73/worldmonitor@ffec79ac33 (2026-08-12).
Data as JSON: /api/errors/943b98c2dd08b028.
Report an issue: GitHub.