Skip to content

fix(trigger): use @react-email/render v2 to fix renderToPipeableStream error#4084

Merged
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/fix-react-email-render
Apr 9, 2026
Merged

fix(trigger): use @react-email/render v2 to fix renderToPipeableStream error#4084
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/fix-react-email-render

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Import render from @react-email/render (v2.0.0) instead of @react-email/components (which uses a nested v1.0.5 with broken CJS/ESM interop)
  • Remove unnecessary @react-email/components from Trigger.dev additionalPackages
  • Fixes reactDOMServer.renderToPipeableStream is not a function error in lifecycle email task

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 9, 2026 9:41pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 9, 2026

PR Summary

Medium Risk
Changes the email HTML rendering dependency and Trigger.dev bundled packages, which can affect all background email tasks if the new renderer behaves differently or packaging misses a dependency.

Overview
Fixes a Trigger.dev runtime error during email tasks by switching render imports from @react-email/components to @react-email/render in both the shared email renderer and Stripe invoice webhook email sending.

Updates trigger.config.ts to stop bundling @react-email/components and only include @react-email/render in additionalPackages, aligning the worker environment with the new renderer.

Reviewed by Cursor Bugbot for commit b80532b. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 9, 2026

Greptile Summary

This PR fixes a reactDOMServer.renderToPipeableStream is not a function error in Trigger.dev lifecycle email tasks by switching the render import source from @react-email/components (which vendors a CJS-only v1.0.5 of @react-email/render) to @react-email/render v2 directly, and removes @react-email/components from the Trigger.dev additionalPackages list. The changes are minimal and targeted, touching only the import statement in two files and the build config.

Confidence Score: 5/5

Safe to merge — targeted import fix with no logic changes and no new issues introduced.

All three files contain only the corrected import source and/or the trimmed build config entry. All render() call sites already used await, making them fully compatible with the v2 async API. No custom rule violations found.

No files require special attention.

Vulnerabilities

No security concerns identified. The change only affects which package provides the render function for React Email — no auth, data handling, or input validation is modified.

Important Files Changed

Filename Overview
apps/sim/components/emails/render.ts Import source for render changed from @react-email/components to @react-email/render; all call sites already use await render(...) matching the v2 async API.
apps/sim/lib/billing/webhooks/invoices.ts Same import source fix applied; usage of await render(...) is consistent with the v2 async API. No other logic changes.
apps/sim/trigger.config.ts Removed @react-email/components from additionalPackages; @react-email/render (already present) remains, which is all that's needed.

Sequence Diagram

sequenceDiagram
    participant T as Trigger.dev Task
    participant R as render.ts / invoices.ts
    participant RE as @react-email/render v2
    participant E as Email Component

    T->>R: call renderXxxEmail(params)
    R->>E: construct JSX element
    R->>RE: await render(element)
    RE-->>R: Promise<string> (HTML)
    R-->>T: HTML string
    T->>T: sendEmail({ html })
Loading

Reviews (1): Last reviewed commit: "fix(trigger): use @react-email/render v2..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 merged commit 32bdf3c into staging Apr 9, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/fix-react-email-render branch April 9, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant