-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: A Node.js API is used (MessageChannel) which is not supported in the Edge Runtime. #1630
Comments
Not 100% sure we can do something about this as I've also noticed that the issue goes away when downgrading the React version and Next version to latest, so I do believe we will have support for MessageChannel and this issue going away soon. That being said, we should keep the issue open until it is fixed on Next. I suppose you can also downgrade React to an RC that did not use MessageChannel yet. |
@gabrielmfern , I’m not sure if supporting the Edge runtime as a separate environment, alongside browser and Node, is within the scope of react-email. However, if it is, you might find it helpful to review how the Next.js team addressed this issue here. They used the |
Definitely within the scope. Thanks for letting us know about the |
On another note, seems like Next 15 with edge routes also have this error when using the latest |
Wrote my own render function using
It solves the problem but I encountered a new issue instead: It seems like React mail is not supporting NextJS 15 unfortunately. I'm not sure how to get past this. In any case If it's complicated to support edge in the same render function due to backwards compatibility I would't mind having a separate render function for edge runtime. :) |
@cjkihl Noticed the same error when experimenting with the export. Looking at the compiled code, I am pretty sure this is because Next does its thing with pre-compiled React versions while still involving the user's React version, might be a bug on their side. |
Made an issue about the error when trying to render with |
Based on what I get from vercel/next.js#71865 (comment), this issue is probably only going to be fully fixed once we get react-markup fully implemented and released, unless we might adopt it while it is still experimental |
So I just got this issue today myself, but I've been using Pages Router and it wasn't happening until I tried to refactor to use App Router instead. In both scenarios, I have the function set to use Edge Runtime. Is everybody here only using App Router? If so, does the issue resolve if you switch to Pages Router? Edit: I just realized that somebody on the Next team confirmed this on the issue that @gabrielmfern logged there. So if you don't mind switching to Pages Router, that seems to be a temporary workaround. |
Is there a timeline for react-markup anywhere? |
@dualdetail Not that I know of, I don't think that they even announced it anywhere yet. But I assume it might release around the time React 19 is released. |
Describe the Bug
Using React 19 + Next.js 15
I want to use
@react-email/render
on edge runtime. However, I got this error:Which package is affected (leave empty if unsure)
@react-email/render
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/react-email-render-on-edge-runtime-5dlkxp
To Reproduce
/api/email
Expected Behavior
No errors. And render the component successfully in email.
What's your node version? (if relevant)
No response
The text was updated successfully, but these errors were encountered: