Noah-Haf
Noah-Haf3w ago

Relative import path not prefixed with / or ./ or ../ from - Convex function

Hi, I'm quite new to convex so I apologise if I've missed something here. However, when I attempt to send an email inside a convex function using resend I get an error like this:
# SERVER_ERROR: [Error: Relative import path "@react-email/render" not prefixed with / or ./ or ../ from "convex:/_deps/S5LTQZFU.js"]
# SERVER_ERROR: [Error: Relative import path "@react-email/render" not prefixed with / or ./ or ../ from "convex:/_deps/S5LTQZFU.js"]
My code:
const { data, error } = await resend.emails.send({
from: `**** ${env.RESEND_SENDER}`,
to: user.email,
subject: "Verify your email address.",
react: <VerifyEmail name={`${user.name}`} url={url} />,
});
const { data, error } = await resend.emails.send({
from: `**** ${env.RESEND_SENDER}`,
to: user.email,
subject: "Verify your email address.",
react: <VerifyEmail name={`${user.name}`} url={url} />,
});
Any advice on what may be going on here? Many thanks, Noah
2 Replies
Noah-Haf
Noah-HafOP3w ago
Runtimes | Convex Developer Hub
Learn the differences between the Convex and Node.js runtimes for functions
Noah-Haf
Noah-HafOP3w ago
I've fixed by manually rendering the email as html with the resend library:
import { render } from '@react-email/components';

const emailHtml = await render(<VerifyEmail name={`${user.name}`} url={url} />);
import { render } from '@react-email/components';

const emailHtml = await render(<VerifyEmail name={`${user.name}`} url={url} />);

Did you find this page helpful?