Middleware fix again

This commit is contained in:
Atridad Lahiji 2023-10-15 00:15:22 -03:00
parent fefffc88b5
commit 4301815655
No known key found for this signature in database

View file

@ -1,6 +1,6 @@
import { authMiddleware } from "@clerk/nextjs";
import { validateRequest } from "./app/_lib/unkey";
import { NextResponse } from "next/server";
import { NextRequest, NextResponse } from "next/server";
import { Ratelimit } from "@upstash/ratelimit";
import { Redis } from "@upstash/redis";
import { env } from "./env.mjs";
@ -18,7 +18,7 @@ export default authMiddleware({
ignoredRoutes: ["/"],
publicRoutes: ["/api/external/(.*)", "/api/webhooks/(.*)"],
apiRoutes: ["/api/internal/(.*)"],
beforeAuth: async (req) => {
beforeAuth: async (req: NextRequest) => {
const { success } = await rateLimit.limit(req.ip || "");
if (success) {
if (req.nextUrl.pathname.includes("/api/external/private")) {