Open LVSSandeepKumar opened 1 month ago
The task involves updating the middleware in a Next.js application to use the new clerkMiddleware
instead of the deprecated authMiddleware
. Additionally, we need to verify if the environment variables NEXT_CLERK_AFTER_SIGN_UP_URL
and NEXT_CLERK_AFTER_SIGN_IN_URL
are still required.
middleware.ts
middleware.ts
file in your code editor.clerkMiddleware
from @clerk/nextjs
.authMiddleware
function call with clerkMiddleware
.middleware.ts
:import { clerkMiddleware } from "@clerk/nextjs";
export default clerkMiddleware({
publicRoutes: ['/']
});
export const config = {
matcher: ["/((?!.+.[w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
};
Review Clerk Documentation:
Update .env.local
:
NEXT_CLERK_AFTER_SIGN_UP_URL
and NEXT_CLERK_AFTER_SIGN_IN_URL
are no longer needed, you can leave the .env.local
file as it is (empty) or remove any existing references to these variables.Code Changes:
NEXT_CLERK_AFTER_SIGN_UP_URL
and NEXT_CLERK_AFTER_SIGN_IN_URL
is updated or removed accordingly.clerkMiddleware
.By following these steps, you will successfully update the middleware to use the new clerkMiddleware
as per the latest Clerk documentation and verify the necessity of the environment variables.
Click here to create a Pull Request with the proposed solution
Files used for this task:
authMiddleware() is deprecated by the time of your youtube video release.
Reference :- https://clerk.com/docs/references/nextjs/auth-middleware
As mentioned in the above link, we should be using clerkMiddleware(). So I would like to request you to update the video with clerkMiddleware().
Also there is a buzz (Even I'm not sure) that we don't need NEXT_CLERK_AFTER_SIGN_UP_URL & NEXT_CLERK_AFTER_SIGN_IN_URL anymore. Plz checkout and update the content.
Thank you.
authMiddleware() is deprecated by the time of your youtube video release.
Reference :- https://clerk.com/docs/references/nextjs/auth-middleware
As mentioned in the above link, we should be using clerkMiddleware(). So I would like to request you to update the video with clerkMiddleware().
Also there is a buzz (Even I'm not sure) that we don't need NEXT_CLERK_AFTER_SIGN_UP_URL & NEXT_CLERK_AFTER_SIGN_IN_URL anymore. Plz checkout and update the content.
Thank you.
Alright thanks for the notice. I will update the course
authMiddleware() is deprecated by the time of your youtube video release.
Reference :- https://clerk.com/docs/references/nextjs/auth-middleware
As mentioned in the above link, we should be using clerkMiddleware(). So I would like to request you to update the video with clerkMiddleware().
Also there is a buzz (Even I'm not sure) that we don't need NEXT_CLERK_AFTER_SIGN_UP_URL & NEXT_CLERK_AFTER_SIGN_IN_URL anymore. Plz checkout and update the content.
Thank you.