-
Notifications
You must be signed in to change notification settings - Fork 692
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
Upgrade of next@14.0.0 #989
Comments
also happens for me on Node 18.17.0 |
Same issue here |
Does anyone know a solution? |
rollback to 13.5 😢 |
Let's address this issue ASAP to unblock people. |
Yeah, same story here. 😅 |
Yeah, same error here. react-emails doesnot work with NextJS ! |
Duplicate of #868, including some possible workarounds for now |
If you're encountering challenges following an upgrade to Next.js 14, here's how I successfully worked around the issue: #868 (comment) |
Are you guys using something like this? import { render } from '@react-email/render';
import { MyEmail } from '../../../emails/my-email';
import { NextResponse } from 'next/server';
export const runtime = 'edge'
export const GET = async () => {
const html = await render(MyEmail());
return NextResponse.json({ html }, { status: 200 })
} |
@bukinoshita I am using it in conjunction with next-auth to send one time login link emails.
import NextAuth from 'next-auth';
import { PrismaAdapter } from '@auth/prisma-adapter';
import { render } from '@react-email/render';
import { sendgridBaseOptions, sendgridClient } from '@/utils/sendgrid';
import { LoginMagicLink } from '../../../../../emails/login';
import prisma from '../../../../../lib/prisma';
type VerificationRequest = {
identifier: string;
url: string;
};
export const authOptions: any = {
adapter: PrismaAdapter(prisma),
providers: [
{
id: 'sendgrid',
type: 'email',
async sendVerificationRequest({ identifier, url }: VerificationRequest) {
const emailHtml = render(LoginMagicLink({ url })); // <-------- react-email creation
const options = {
...sendgridBaseOptions,
subject: 'Welcome! Here is your login link.',
html: emailHtml,
};
await sendgridClient.send({ ...options, to: identifier });
},
},
],
};
const handler = NextAuth(authOptions);
export { handler as GET, handler as POST }; |
Can you try using the canary version of render to see if this is still happening? {
...,
"@react-email/render": "0.0.9-canary.0",
} |
I am having the same issue as @niels-bosman, trying to send a verification request in next-auth. Trying the canary now |
Unfortunately no changes:
From my
Which indicates I have both version of
Gives me
So looks like that has upgraded properly |
@bukinoshita I can confirm that the new canary version did not resolve my issues either. Edit: shouldn't https://react.dev/reference/react-dom/server/renderToPipeableStream be used instead of On https://react.dev/reference/react-dom/server/renderToString#alternatives it says that the renderToPipeableStream method should be used for node environments (like what Next.js uses). |
can also confirm, same error when upgrading next from 13.5.6 to 14.0.0 (no other changes) |
Thanks for confirming, we're still investigating and testing |
We just released a new canary version here's an example on Next.js 14 app router edge import { NextResponse } from 'next/server';
import { EmailTemplate } from '../../../components/email-template';
import { renderAsync } from '@react-email/render';
export const runtime = 'edge';
export async function GET() {
try {
const html = await renderAsync(
EmailTemplate({ firstName: 'John' }) as React.ReactElement
);
return NextResponse.json({ html });
} catch (error) {
return NextResponse.json({ error });
}
} |
@bukinoshita personally I don't use it via a route handler but trigger Resend to send the email from a Server Action. I've manually installed the canary version alongside the other resend/react-email packages: "@react-email/body": "0.0.3",
"@react-email/button": "0.0.10",
"@react-email/column": "0.0.7",
"@react-email/container": "0.0.8",
"@react-email/font": "0.0.3",
"@react-email/head": "0.0.5",
"@react-email/heading": "0.0.8",
"@react-email/html": "0.0.4",
"@react-email/img": "0.0.5",
"@react-email/link": "0.0.5",
"@react-email/preview": "0.0.6",
"@react-email/row": "0.0.5",
"@react-email/section": "0.0.9",
"@react-email/tailwind": "0.0.9",
"@react-email/text": "0.0.5",
"@react-email/render": "0.0.9-canary.2",
"react-email": "1.9.5", I've also updated next to
Hope this might help, fixing the issue. |
Can you follow up on the Resend issue instead? (resend/resend-node#244) We tested in these scenarios and all of them passed.
|
@bukinoshita I created this reproduction repo to demonstrate a minimum reproduction of my issue. Simply install dependencies, run the dev script and open the page to reproduce the issue. https://github.com/niels-bosman/next-14-react-email-reproduction-repo |
Please, can you try |
This gives me the same exact error message unfortunately. |
Oh, I got it. The error you're getting is from the Checking the email code, you can remove these packages
And install the:
In the
|
@bukinoshita The canary versions ( |
Can confirm that this resolved my issue! |
We just added support for Next 14! 🎉 To upgrade, you can bump Alternatively, if you're using the render util directly, you can update to |
The synchronous
when calling from
|
How to fix it when using server actions? The code is following:
|
Does this break Tailwind support? |
Solution here - resend/resend-node#256 |
@bukinoshita Thanks a lot! It works for me! 🚀 |
Describe the Bug
Hello !
I've just update my project to Next v14 but I had this error generated by upgrading :
Do you think that you can fix this error on your package ?
Thanks for all
Which package is affected (leave empty if unsure)
@react-email/render
Link to the code that reproduces this issue
To Reproduce
Expected Behavior
Ability to upgrading to Next 14.0 without error
What's your node version? (if relevant)
21
The text was updated successfully, but these errors were encountered: