fix(render): edge environment errors with MessageChannel#2225
fix(render): edge environment errors with MessageChannel#2225gabrielmfern merged 19 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: 8549fa1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
2eba90b to
98c3d9b
Compare
0074ddf to
f7e553f
Compare
201fd73 to
b5b9089
Compare
|
Does this address also this issue? #1630 |
|
@adrai yes, but introduces another error for Next.js running on the edge |
react-dom/server.edge on edge environments
lucasfcosta
left a comment
There was a problem hiding this comment.
LGTM! I also tested this manually on CloudFlare and was able to repro both the error and the fix.
As I discussed with @gabrielmfern it seems that 1.1.0 of @react-email/render doesn't cause this, so one has to ensure it's resolving to 1.2.0 to be able to reproduce it.
Once reproduced, this PR's changeset fixes it (pnpm i https://pkg.pr.new/resend/react-email/@react-email/render@2225).
This is meant for partially fixing #1630 which is caused by a browser JS API trying to be used on the edge environment. React DOM does provide this
react-dom/server.edgeexport that you can use which doesn't use that API, and works for raw edge environments, like Cloudflare Workers. I've tested this on our Cloudflare Workers ExampleBut, when running in Next.js on the edge, this error happens after this pull request:
And according to vercel/next.js#71865, this happens because we're running React DOM in a React Server environment which isn't really allowed. Not sure what we can do to actually circumvent this, except for waiting for https://github.com/facebook/react/tree/main/packages/react-markup to get into a stable version, or use the experimental itself.