-
Notifications
You must be signed in to change notification settings - Fork 820
fix(render): edge environment errors with MessageChannel #2225
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
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 environmentsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.edge
export 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.