feat: exclude webhook route from rate limiting
This commit is contained in:
@@ -4,7 +4,6 @@ import type { Readable } from "node:stream";
|
||||
import { createNextApiContext } from "@kan/api/trpc";
|
||||
import * as workspaceRepo from "@kan/db/repository/workspace.repo";
|
||||
import { createStripeClient } from "@kan/stripe";
|
||||
import { withRateLimit } from "~/utils/rateLimit";
|
||||
|
||||
async function buffer(readable: Readable) {
|
||||
const chunks = [];
|
||||
@@ -14,9 +13,10 @@ async function buffer(readable: Readable) {
|
||||
return Buffer.concat(chunks);
|
||||
}
|
||||
|
||||
export default withRateLimit(
|
||||
{ points: 100, duration: 60 },
|
||||
async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse,
|
||||
) {
|
||||
const stripe = createStripeClient();
|
||||
|
||||
if (req.method !== "POST") {
|
||||
@@ -64,8 +64,7 @@ export default withRateLimit(
|
||||
console.error("Webhook error:", err);
|
||||
return res.status(400).json({ message: "Webhook handler failed" });
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const config = {
|
||||
api: {
|
||||
|
||||
Reference in New Issue
Block a user