Hendrixer/fullstack-music

Unhandled Runtime Error Error: URLs is malformed.

Opened this issue · 1 comments

loerk commented

i ran into this issue in the middleware.ts file. I solved it with changing it into this, just in case someone else has this problem

export default function middleware(req: NextRequest) {
  if (signedinPages.find((p) => p === req.nextUrl.pathname)) {
    const token = req.cookies.TRAX_ACCESS_TOKEN;
    const url = req.nextUrl.clone();
    url.pathname = "/signin";
    if (!token) {
      return NextResponse.redirect(url);
    }
  }
}

thanks a lot @loerk !