clerk / example-cypress-nextjs

Example repo using Clerk, Cypress and NextJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update to include authMiddleware

knightjdr opened this issue · comments

Can this example be updated to include middleware following the getting started guide for nextjs?

import { authMiddleware } from "@clerk/nextjs";

export default authMiddleware();

export const config = {
  matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
};

Upgrading @clerk/nextjs to 4.19.1, adding the above middleware, and running npm run dev results in

error - (middleware)/node_modules/@clerk/nextjs/dist/esm/server-helpers.client.js (2:0) @ <unknown>
error - authMiddleware() can only be used in a server environment.