mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-01 03:06:32 +02:00
🚧 Temporarily disable message queue (#1449)
This commit is contained in:
parent
3f405003fd
commit
9b606bdbdc
3 changed files with 25 additions and 31 deletions
|
@ -1,12 +1,16 @@
|
||||||
import * as Sentry from "@sentry/nextjs";
|
import * as Sentry from "@sentry/nextjs";
|
||||||
|
import { verifySignatureAppRouter } from "@upstash/qstash/dist/nextjs";
|
||||||
import type { NextRequest } from "next/server";
|
import type { NextRequest } from "next/server";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
import { getEmailClient } from "@/utils/emails";
|
import { getEmailClient } from "@/utils/emails";
|
||||||
|
|
||||||
import { verifySignature } from "./verify-signature";
|
export const POST = async (req: NextRequest) => {
|
||||||
|
/**
|
||||||
export const POST = verifySignature(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();
|
const body = await req.json();
|
||||||
|
|
||||||
// TODO: Add validation for templateName and options
|
// TODO: Add validation for templateName and options
|
||||||
|
@ -25,4 +29,5 @@ export const POST = verifySignature(async (req: NextRequest) => {
|
||||||
{ status: 500 },
|
{ status: 500 },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
})(req);
|
||||||
|
};
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -72,12 +72,13 @@ export class EmailClient {
|
||||||
templateName: T,
|
templateName: T,
|
||||||
options: SendEmailOptions<T>,
|
options: SendEmailOptions<T>,
|
||||||
) {
|
) {
|
||||||
|
const isQueueEnabled = false; // TODO: Enable this
|
||||||
const createEmailJob = async () => {
|
const createEmailJob = async () => {
|
||||||
const client = createQstashClient();
|
const client = createQstashClient();
|
||||||
|
|
||||||
if (client) {
|
if (client && isQueueEnabled) {
|
||||||
const queue = client.queue({
|
const queue = client.queue({
|
||||||
queueName: "emails",
|
queueName: "emails-mq",
|
||||||
});
|
});
|
||||||
|
|
||||||
queue
|
queue
|
||||||
|
|
Loading…
Add table
Reference in a new issue