anmot.A
Convex Community17mo ago
8 replies
anmot.

Convex Auth - /api/auth/ - 404 not found

Getting 404 on client for this API call - http://localhost:3000/api/auth/

Auth type: Phone OTP
auth:signIn action is working and I'm able to get the OTP when running from convex dashboard, so I assume server part is fine.

Client: Next Js
- Wrapped ConvexAuthNextjsServerProvider in RootLayout.
- Wrapped ConvexAuthNextjsProvider in ConvexClientProvider.

Middleware.ts
import {
  convexAuthNextjsMiddleware,
  isAuthenticatedNextjs
} from "@convex-dev/auth/nextjs/server";
import { NextResponse } from "next/server";


// export default convexAuthNextjsMiddleware();

export default convexAuthNextjsMiddleware((request) => {
  console.log("### middleware", request.url);
  console.log("### isAuthenticatedNextjs", isAuthenticatedNextjs());
  return NextResponse.next();
});

export const config = {
  // The following matcher runs middleware on all routes
  // except static assets.
  matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
};


I'm able to see the output logs
web-store:dev: ### middleware http://localhost:3000/api/auth/
web-store:dev: ### isAuthenticatedNextjs false


Tried deleting .nextjs and built the client multiple times. No luck.

Network logs:
image.png
Was this page helpful?