What is the proper way to set up a route with next pages?
The docs don't paint a full picture and I'm confused. Allegedly, photo one is how the route is supposed to look, but when I use that route I get an internal server error when navigating to it and the following error:
✘ [ERROR] N [Error]: The middleware "/api/oauth/apple/login" accepts an async API directly with the form:
export function middleware(request, event) {
return NextResponse.redirect('/new-location')
}
However, when I use the 2nd route, the page loads fine however I don't have access to the environment variables I've set in .dev.vars


1 Reply
for anyone stumbling upon this in the future
after 3 days ive figured out this is the proper way to access the env variable and reconfigure a route if you are coming from a next.js application, nowhere in the docs is this clear at all
