Describe the bug
I can't seem to get withAuth() to work in API routes. I want to be able to access the user object and organizationId etc in protected API routes through withAuth() but when I add the api routes to the middleware configs, I seem to get 404 html errors when calling the api endpoints.
To Reproduce
Steps to reproduce the behavior:
- Middleware.ts set up authkitMiddleware() as usual
- Add
/api/something to the middleware config
- In
/api/something/route.ts, create a GET handler and call withAuth()
- See error
Expected behavior
When I add /api/something as a protected route, I should be able to call withAuth() or some other function in the route.ts to access the user, organizationId, etc in the same way as in a protected page.
Screenshots
After adding the route to middleware config

Without adding the route to middleware config

Versions:
- OS [MacOS]
- Browser [Chrome]
- authkit-nextjs version [2.13.0]
- Next.js version [16.0.1]
Describe the bug
I can't seem to get
withAuth()to work in API routes. I want to be able to access the user object and organizationId etc in protected API routes through withAuth() but when I add the api routes to the middleware configs, I seem to get 404 html errors when calling the api endpoints.To Reproduce
Steps to reproduce the behavior:
/api/somethingto the middleware config/api/something/route.ts, create a GET handler and call withAuth()Expected behavior
When I add
/api/somethingas a protected route, I should be able to call withAuth() or some other function in the route.ts to access the user, organizationId, etc in the same way as in a protected page.Screenshots

After adding the route to middleware config
Without adding the route to middleware config

Versions: