{"record":{"id":"ebc71f406b78d6e8","repo":"koala73/worldmonitor","slug":"createprolaunchbroadcast-resend-api-key-not-set","errorCode":null,"errorMessage":"[createProLaunchBroadcast] RESEND_API_KEY not set","messagePattern":"\\[createProLaunchBroadcast\\] RESEND_API_KEY not set","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"convex/broadcast/sendBroadcast.ts","lineNumber":68,"sourceCode":"/**\n * Create a Resend Broadcast from the locked launch content. Does NOT\n * send — separate `sendProLaunchBroadcast` step. Returns the new\n * broadcast id so the operator can preview in the Resend dashboard\n * before firing.\n *\n * Idempotency: NOT idempotent on segmentId. Calling twice with the same\n * segment creates two separate broadcasts. The operator owns \"have I\n * already created this?\" tracking.\n */\nexport const createProLaunchBroadcast = internalAction({\n  args: {\n    segmentId: v.string(),\n    nameSuffix: v.optional(v.string()),\n  },\n  handler: async (_ctx, { segmentId, nameSuffix }) => {\n    const apiKey = process.env.RESEND_API_KEY;\n    if (!apiKey) {\n      throw new Error(\"[createProLaunchBroadcast] RESEND_API_KEY not set\");\n    }\n\n    // Hard-gate: refuse to ship the placeholder physical address.\n    // CAN-SPAM requires a valid postal address in every commercial\n    // email footer; sending the literal \"physical address TBD\" string\n    // is non-compliant and embarrassing. Edit\n    // `PRO_LAUNCH_PHYSICAL_ADDRESS` in proLaunchEmailContent.ts to the\n    // real postal address before invoking this action.\n    if (\n      PRO_LAUNCH_PHYSICAL_ADDRESS.includes(\"TBD\") ||\n      PRO_LAUNCH_PHYSICAL_ADDRESS.includes(\"placeholder\")\n    ) {\n      throw new Error(\n        `[createProLaunchBroadcast] PRO_LAUNCH_PHYSICAL_ADDRESS is still a placeholder (\"${PRO_LAUNCH_PHYSICAL_ADDRESS}\"). ` +\n          \"Set the real CAN-SPAM postal address in convex/broadcast/proLaunchEmailContent.ts before sending.\",\n      );\n    }\n","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/convex/broadcast/sendBroadcast.ts#L50-L86","documentation":"Configuration gate in the createProLaunchBroadcast action: process.env.RESEND_API_KEY is unset on the Convex deployment, so no Resend API call is possible. The action fails fast before creating anything rather than failing mid-flow with partial state.","triggerScenarios":"Thrown at convex/broadcast/sendBroadcast.ts:68 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set RESEND_API_KEY in the Convex dashboard environment variables and retry","Add a deployment checklist step verifying Resend env vars before running broadcast operations"],"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"}