Skip to content

Conversation

@gabrielmfern
Copy link
Member

@gabrielmfern gabrielmfern commented Jan 20, 2026

We were getting this error at https://react.email when rendering components because the new ErrorBoundary approach to avoid client side rendering fallback was using React class components, which doesn't work in Server Components

 TypeError: Class extends value undefined is not a constructor or null

This might be caused by a React Class Component being rendered in a Server Component, React Class Components only works in Client Components. Read more: https://nextjs.org/docs/messages/class-component-in-server-component
     at createErrorBoundary (../../packages/render/src/shared/error-boundary.tsx:7:46)
    at <unknown> (../../packages/render/src/node/render.tsx:22:29)

We could define a separate export for react-server, but it also so happens React.Component is undefined in server environments, and we can just check for that.


Summary by cubic

Fixes server component rendering by making ErrorBoundary safe in React Server Components. Adds a guard for React.Component and falls back to a pass-through boundary so pages render without crashing.

  • Bug Fixes
    • Check if React.Component is defined; if not, return a no-op boundary that renders children.
    • Keep class-based ErrorBoundary for client components.
    • Prevents internal server errors seen on react.email.

Written for commit 423dd5e. Summary will update on new commits.

@gabrielmfern gabrielmfern requested a review from a team January 20, 2026 13:10
@gabrielmfern gabrielmfern self-assigned this Jan 20, 2026
@gabrielmfern gabrielmfern requested review from bukinoshita and removed request for a team January 20, 2026 13:10
@changeset-bot
Copy link

changeset-bot bot commented Jan 20, 2026

🦋 Changeset detected

Latest commit: 423dd5e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@react-email/render Patch
@react-email/components Patch
playground Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jan 20, 2026

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

Project Deployment Review Updated (UTC)
react-email Ready Ready Preview, Comment Jan 20, 2026 1:12pm
react-email-demo Ready Ready Preview, Comment Jan 20, 2026 1:12pm

Request Review

@gabrielmfern gabrielmfern requested review from a team and isabellaaquino and removed request for a team and bukinoshita January 20, 2026 13:11
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 20, 2026

Open in StackBlitz

npm i https://pkg.pr.new/resend/react-email/@react-email/render@2871

commit: 423dd5e

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@gabrielmfern gabrielmfern merged commit 635dc8f into canary Jan 20, 2026
16 of 17 checks passed
@gabrielmfern gabrielmfern deleted the fix/internal-server-errors-in-components branch January 20, 2026 13:13
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.

3 participants