Skip to content

render + renderAsync not working in the next.js edge #1054

@VaniaPopovic

Description

@VaniaPopovic

Describe the Bug

Hello,

I have recently been trying to migrate an app we have been using from next-auth 4 to the next-auth 5 beta. Beta allows for the next-auth middleware to run on edge, however @react-email/render doesn't seem to be compatible with it.

It fails with the following message

[Error: Internal Error: do not use legacy react-dom/server APIs. If you encountered this error, please open an issue on the Next.js repo.]
[Error: Internal Error: do not use legacy react-dom/server APIs. If you encountered this error, please open an issue on the Next.js repo.]
 ⨯ node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\esm\build\noop-react-dom-server-legacy.js (6:10) @ renderToStaticMarkup
 ⨯ Internal Error: do not use legacy react-dom/server APIs. If you encountered this error, please open an issue on the Next.js repo.
null
 ⨯ node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\esm\build\noop-react-dom-server-legacy.js (6:10) @ renderToStaticMarkup
 ⨯ Internal Error: do not use legacy react-dom/server APIs. If you encountered this error, please open an issue on the Next.js repo.
null
[Error: Internal Error: do not use legacy react-dom/server APIs. If you encountered this error, please open an issue on the Next.js repo.]
 ⨯ node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\esm\build\noop-react-dom-server-legacy.js (6:10) @ renderToStaticMarkup
 ⨯ Internal Error: do not use legacy react-dom/server APIs. If you encountered this error, please open an issue on the Next.js repo.
null
[Error: Internal Error: do not use legacy react-dom/server APIs. If you encountered this error, please open an issue on the Next.js repo.]
 ⨯ node_modules\.pnpm\[email protected][email protected][email protected]\node_modules\next\dist\esm\build\noop-react-dom-server-legacy.js (6:10) @ renderToStaticMarkup
 ⨯ Internal Error: do not use legacy react-dom/server APIs. If you encountered this error, please open an issue on the Next.js repo.

Which package is affected (leave empty if unsure)

@react-email/render

Link to the code that reproduces this issue

https://github.com/VaniaPopovic/react-email-repro

To Reproduce

Clone the above repositiory and head to http://localhost:3000/api/test

  • The sample renders the vercel-invite-user in a node endpoint ( similar to what next-auth is doing when trying to send the confirmation email in v4)
  • The sample fails to render when using
 export const runtime = "edge";

Expected Behavior

For render and renderAsync to work in both runtimes

What's your node version? (if relevant)

20.6.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions