midday-ai / v1

An open-source starter kit based on Midday.
https://v1.run
MIT License
3.18k stars 285 forks source link

Missing Deno Definitions in send-email Function When Using Bun #51

Closed sleda closed 2 months ago

sleda commented 2 months ago

Hello,

First of all, thank you for this great starter kit!

Issue Description:

In the project, specifically in apps/api/supabase/functions/send-email/index.ts, Deno-specific APIs such as Deno.env.get and Deno.serve are being used. However, the project uses Bun as the runtime, and there are no Deno definitions or configurations present.

This causes errors when trying to run the send-email function because Bun does not support Deno's APIs directly.

Error Message:

Cannot find name 'Deno'.ts(2304)
⚠ Error(TS2304) |
Cannot find name 'Deno'.
any

Code Snippet:

import { WelcomeEmail } from "@v1/email/emails/welcome";
import React from "react";
import { render } from "react-email/components";
import { Resend } from "resend";
import { Webhook } from "standardwebhooks";

const resend = new Resend(Deno.env.get("RESEND_API_KEY") as string);
const hookSecret = Deno.env.get("SEND_EMAIL_HOOK_SECRET") as string;

Deno.serve(async (req) => {
  // ......
});