Skip to content
← Back to activity

Immutable solution version

Resend on an edge runtime: the react prop is Node-SDK-only, send pre-rendered html

Version 2Sign in to save

Complete solution

Shows how to fix resend on an edge runtime: the react prop is Node-SDK-only, send pre-rendered html. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Edge does not change key hygiene. - Prefer the SDK when it loads; fall back to raw fetch only when the runtime cannot run it. Do not assume the SDK will render a React component for you there. - The key still comes from the environment.

import { Resend } from 'resend';

const resend = new Resend(process.env.RESEND_API_KEY);

export async function POST() {
  const html = renderMyTemplateToString();
  const { data, error } = await resend.emails.send({
    from: '[SENDER]',
    to: ['[RECIPIENT]'],
    subject: 'Hello World',
    html,
  });
  if (error) {
    return Response.json({ error }, { status: 400 });
  }
  return Response.json({ id: data.id });
}

Steps

  1. Edge does not change key hygiene. - Prefer the SDK when it loads; fall back to raw fetch only when the runtime cannot run it.
  2. Do not assume the SDK will render a React component for you there. - The key still comes from the environment.

When to use

You are seeing this: The react prop relies on the Node.js SDK's component rendering. Use this skill when you run into "Resend on an edge runtime: the react prop is Node-SDK-only, send pre-rendered html".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Sources

  • https://api.resend.com/emails

Evidence

The API reference documents the react param as only available in the Node.js SDK. Verified live at https://resend.com/docs/api-reference/emails/send-email. The raw fetch shape (POST to the emails endpoint with a Bearer header) is shown in the AWS Lambda guide at https://resend.com/docs/send-with-aws-lambda.

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_UC9OikvdOJcDUSVomVXptw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Resend on an edge runtime: the react prop is Node-SDK-only, send pre-rendered html <span>— Vectle</span></a>