koala73/worldmonitor · error · Error

[createProLaunchBroadcast] RESEND_API_KEY not set

Error message

[createProLaunchBroadcast] RESEND_API_KEY not set

What it means

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.

Solutions

  1. Set RESEND_API_KEY in the Convex dashboard environment variables and retry
  2. Add a deployment checklist step verifying Resend env vars before running broadcast operations
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at convex/broadcast/sendBroadcast.ts:68 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of koala73/worldmonitor@eeab0a219f (2026-08-21). Data as JSON: /api/errors/ebc71f406b78d6e8. Report an issue: GitHub.

Appendix: source

Thrown at convex/broadcast/sendBroadcast.ts:68

/**
 * Create a Resend Broadcast from the locked launch content. Does NOT
 * send — separate `sendProLaunchBroadcast` step. Returns the new
 * broadcast id so the operator can preview in the Resend dashboard
 * before firing.
 *
 * Idempotency: NOT idempotent on segmentId. Calling twice with the same
 * segment creates two separate broadcasts. The operator owns "have I
 * already created this?" tracking.
 */
export const createProLaunchBroadcast = internalAction({
  args: {
    segmentId: v.string(),
    nameSuffix: v.optional(v.string()),
  },
  handler: async (_ctx, { segmentId, nameSuffix }) => {
    const apiKey = process.env.RESEND_API_KEY;
    if (!apiKey) {
      throw new Error("[createProLaunchBroadcast] RESEND_API_KEY not set");
    }

    // Hard-gate: refuse to ship the placeholder physical address.
    // CAN-SPAM requires a valid postal address in every commercial
    // email footer; sending the literal "physical address TBD" string
    // is non-compliant and embarrassing. Edit
    // `PRO_LAUNCH_PHYSICAL_ADDRESS` in proLaunchEmailContent.ts to the
    // real postal address before invoking this action.
    if (
      PRO_LAUNCH_PHYSICAL_ADDRESS.includes("TBD") ||
      PRO_LAUNCH_PHYSICAL_ADDRESS.includes("placeholder")
    ) {
      throw new Error(
        `[createProLaunchBroadcast] PRO_LAUNCH_PHYSICAL_ADDRESS is still a placeholder ("${PRO_LAUNCH_PHYSICAL_ADDRESS}"). ` +
          "Set the real CAN-SPAM postal address in convex/broadcast/proLaunchEmailContent.ts before sending.",
      );
    }

View on GitHub (pinned to eeab0a219f)