{"record":{"id":"fd6998df431f5c66","repo":"koala73/worldmonitor","slug":"sendprolaunchbroadcast-resend-api-key-not-set","errorCode":null,"errorMessage":"[sendProLaunchBroadcast] RESEND_API_KEY not set","messagePattern":"\\[sendProLaunchBroadcast\\] RESEND_API_KEY not set","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"convex/broadcast/sendBroadcast.ts","lineNumber":153,"sourceCode":"/**\n * Send (or schedule) a previously-created Resend Broadcast.\n *\n * `scheduledAt`: ISO 8601 timestamp string OR a natural-language phrase\n * Resend accepts (\"in 2 hours\"). Omit for immediate send.\n *\n * Resend's send endpoint is fire-and-forget — it returns immediately\n * after queueing. Track delivery via the `broadcastEvents` table\n * (populated by webhook events) or the `getBroadcastStats` action.\n */\nexport const sendProLaunchBroadcast = internalAction({\n  args: {\n    broadcastId: v.string(),\n    scheduledAt: v.optional(v.string()),\n  },\n  handler: async (_ctx, { broadcastId, scheduledAt }) => {\n    const apiKey = process.env.RESEND_API_KEY;\n    if (!apiKey) {\n      throw new Error(\"[sendProLaunchBroadcast] RESEND_API_KEY not set\");\n    }\n\n    const body: Record<string, unknown> = {};\n    if (scheduledAt) body.scheduled_at = scheduledAt;\n\n    const res = await fetch(\n      `${RESEND_API_BASE}/broadcasts/${encodeURIComponent(broadcastId)}/send`,\n      {\n        method: \"POST\",\n        headers: {\n          \"Content-Type\": \"application/json\",\n          Authorization: `Bearer ${apiKey}`,\n          \"User-Agent\": USER_AGENT,\n        },\n        body: JSON.stringify(body),\n      },\n    );\n","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/convex/broadcast/sendBroadcast.ts#L135-L171","documentation":"Configuration gate in the sendProLaunchBroadcast action: process.env.RESEND_API_KEY is unset on the Convex deployment, so the send request cannot be authenticated. Fails fast before touching the broadcast.","triggerScenarios":"Thrown at convex/broadcast/sendBroadcast.ts:153 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set RESEND_API_KEY in the Convex dashboard environment variables and retry","Verify the env var is set on the specific deployment (preview vs production) being used"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"eeab0a219fce0f02a00603b532dbae9041b934ac","analyzedAt":"2026-08-21T16:51:25.751Z","contentChangedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}