Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🚧 Temporarily disable message queue (#1449)
Luke Vella9b606bdbdc96
diff --git a/apps/web/src/app/api/send-email/route.ts b/apps/web/src/app/api/send-email/route.tsindex d54de7cdc..52662355e 100644--- a/apps/web/src/app/api/send-email/route.ts+++ b/apps/web/src/app/api/send-email/route.ts@@ -1,28 +1,33 @@import * as Sentry from "@sentry/nextjs";+import { verifySignatureAppRouter } from "@upstash/qstash/dist/nextjs";import type { NextRequest } from "next/server";import { NextResponse } from "next/server";import { getEmailClient } from "@/utils/emails";-import { verifySignature } from "./verify-signature";+export const POST = async (req: NextRequest) => {+ /**+ * We need to call verifySignatureAppRouter inside the route handler+ * to avoid the build breaking when env vars are not set.+ */+ return verifySignatureAppRouter(async (req: NextRequest) => {+ const body = await req.json();-export const POST = verifySignature(async (req: NextRequest) => {- const body = await req.json();+ // TODO: Add validation for templateName and options- // TODO: Add validation for templateName and options+ const emailClient = getEmailClient(body.locale);- const emailClient = getEmailClient(body.locale);+ try {+ await emailClient.sendTemplate(body.templateName, body.options);- try {- await emailClient.sendTemplate(body.templateName, body.options);+ return NextResponse.json({ success: true });+ } catch (error) {+ Sentry.captureException(error);- return NextResponse.json({ success: true });- } catch (error) {- Sentry.captureException(error);-- return NextResponse.json(- { success: false, error: "Failed to send email" },- { status: 500 },- );- }-});+ return NextResponse.json(+ { success: false, error: "Failed to send email" },+ { status: 500 },+ );+ }+ })(req);+};diff --git a/apps/web/src/app/api/send-email/verify-signature.ts b/apps/web/src/app/api/send-email/verify-signature.tsdeleted file mode 100644index b94b18544..000000000--- a/apps/web/src/app/api/send-email/verify-signature.ts+++ /dev/null@@ -1,12 +0,0 @@-import { verifySignatureAppRouter } from "@upstash/qstash/dist/nextjs";-import type { NextRequest } from "next/server";--export async function verifySignature(- handler: (req: NextRequest) => Promise<Response>,-) {- /**- * We need to call verifySignatureAppRouter inside the route handler- * to avoid the build breaking when env vars are not set.- */- return (req: NextRequest) => verifySignatureAppRouter(handler)(req);-}diff --git a/packages/emails/src/send-email.tsx b/packages/emails/src/send-email.tsxindex 70d6d454a..464cb1f9d 100644--- a/packages/emails/src/send-email.tsx+++ b/packages/emails/src/send-email.tsx@@ -72,12 +72,13 @@ export class EmailClient {templateName: T,options: SendEmailOptions<T>,) {+ const isQueueEnabled = false; // TODO: Enable thisconst createEmailJob = async () => {const client = createQstashClient();- if (client) {+ if (client && isQueueEnabled) {const queue = client.queue({- queueName: "emails",+ queueName: "emails-mq",});queue