error with resend
Answered
OGbreadwinners posted this in #help-forum
routes.js
js
import { NextResponse } from "next/server";
import { Resend } from "resend";
const resend = new Resend(process.env.RESEND_API_KEY);
const fromEmail = process.env.FROM_EMAIL;
export async function POST(req, res) {
const { email, subject, message } = await req.json();
console.log(email, subject, message);
try {
const data = await resend.emails.send({
from: fromEmail,
to: [fromEmail, email],
subject: subject,
react: (
<>
<h1>{subject}</h1>
<p>Thank you for contacting us!</p>
<p>New message submitted:</p>
<p>{message}</p>
</>
),
});
return NextResponse.json(data);
} catch (error) {
return NextResponse.json({ error });
}
}8 Replies
so in this section when i hit send msg i get bunch of errors
I have tried finding solutions but i am not understanding whats wrong
NVM
npm install resend@^2.1.0-canary.1 doing this fixed it
Answer