Debug middleware

This commit is contained in:
cte 2025-05-14 21:58:28 -07:00
parent 2c52904e0e
commit 56c7f22503
2 changed files with 22 additions and 24 deletions

View file

@ -6,13 +6,25 @@ const isProtectedRoute = createRouteMatcher([
'/api(.*)',
]);
export default clerkMiddleware(async (auth, req) => {
if (isProtectedRoute(req)) {
await auth.protect();
}
});
export default clerkMiddleware(
async (auth, req) => {
if (isProtectedRoute(req)) {
await auth.protect();
}
},
{ debug: true },
);
// Also exclude tunnelRoute used in Sentry from the matcher.
// export const config = {
// matcher: ['/((?!.+\\.[\\w]+$|_next|monitoring).*)', '/', '/(api|trpc)(.*)'],
// };
export const config = {
matcher: ['/((?!.+\\.[\\w]+$|_next|monitoring).*)', '/', '/(api|trpc)(.*)'],
matcher: [
// Skip Next.js internals and all static files, unless found in search params.
'/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)',
// Always run for API routes.
'/(api|trpc)(.*)',
],
};

View file

@ -1,4 +1,3 @@
/* eslint-disable jsonc/sort-keys */
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
@ -11,7 +10,6 @@
"alwaysStrict": true,
"strictNullChecks": true,
"noUncheckedIndexedAccess": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
@ -19,39 +17,26 @@
"noUnusedParameters": true,
"allowUnreachableCode": false,
"noFallthroughCasesInSwitch": true,
"target": "es2017",
"outDir": "out",
"sourceMap": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"jsx": "preserve",
"noEmit": true,
"isolatedModules": true,
"incremental": true,
// Load types
"types": ["vitest/globals"],
// Path aliases
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"@/public/*": ["./public/*"]
},
// Editor support
"plugins": [
{
"name": "next"
}
]
"plugins": [{ "name": "next" }]
},
"exclude": [
"./out/**/*",
@ -61,10 +46,11 @@
"**/*.e2e.ts"
],
"include": [
"**/*.mts",
"**/*.ts",
"**/*.tsx",
"**/*.mts",
".storybook/*.ts",
"next-env.d.ts",
".storybook/*.ts"
".next/types/**/*.ts"
]
}