Skip to content
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

Not working: Dynamic Code Evaluation #32

Open
lopezjurip opened this issue Mar 15, 2024 · 0 comments
Open

Not working: Dynamic Code Evaluation #32

lopezjurip opened this issue Mar 15, 2024 · 0 comments

Comments

@lopezjurip
Copy link

Not working on Next.js edge functions. Here is an example:

// /pages/api/edge/resend.tsx

import { default as Email } from "@repo/transactional/emails/test"; // my react template
import { Resend } from "resend";
import { renderAsync } from "@react-email/components";

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

export const config = {
  runtime: "edge",
};

// curl http://localhost:9000/api/edge/resend
const handler = async (req) => {
  const result = await resend.emails.send({
    from: "[email protected]",
    to: "[email protected]",
    subject: "Hello World",
    html: await renderAsync(<Email />),
  });

  return new Response(JSON.stringify(result), {
    status: 200,
    headers: { "content-type": "application/json" },
  });
};

export default handler;

Running next build causes:

Failed to compile.
../../node_modules/.pnpm/@[email protected][email protected]/node_modules/@react-email/tailwind/dist/index.mjs
Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime
Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation

Looks like the way it's importing Tailwind's rust compiler is not supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant