NovuN
Novu14mo ago
SubsKeepr

Failed to preview Step with id: `send-email`

I am trying to use a react-email template and I cannot get it to preview in the local studio as I keep getting that error. Other ways seem to work like inline html with vars.

// app/novu/workflows/trial-ending.js
import { workflow } from "@novu/framework";
import { renderTrialEmail } from "../emails/trial-ending";

export const trialEndingWorkflow = workflow(
  "trial-ending",
  async ({ step, payload }) => {
    const isLastDay = payload.daysLeft === 0;
    const daysMessage = isLastDay
      ? "ends today"
      : `ends in ${payload.daysLeft} days`;

    // Push notification if enabled
    await step.push("push", async () => ({
      subject: "Trial Ending Soon",
      body: `${payload.subscriptionName} trial ${daysMessage}`,
    }));

    // Email notification with HTML template
    await step.email("send-email", async (inputs) => ({
      subject: `Your ${payload.subscriptionName} Trial is Ending Soon`,
      body: renderTrialEmail({ ...payload, ...inputs }),
    }));
  }
);
Was this page helpful?