Closed aryanjotwani closed 3 months ago
Running into this same error. My app worked fine before, now I get this. Anyone found an answer to this?
use this middleware.ts it worked for me.
import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";
const isPublicRoute = createRouteMatcher([ "/sign-in(.)", "/sign-up(.)", "/api/webhooks(.*)", "/", "/api/webhooks/clerk", "/api/webhooks/stripe" ]);
export default clerkMiddleware((auth, request) => { if (!isPublicRoute(request)) { auth().protect(); } });
export const config = { matcher: ["/((?!.\..|_next).)", "/", "/(api|trpc)(.)"], };
Unable to create users in the database.
Unhandled Runtime Error Error: Error: User not found
Source lib\utils.ts (18:11) @ handleError
16 | // This is a native JavaScript error (e.g., TypeError, RangeError) 17 | console.error(error.message);