Incorrect request origin in onError of handleAuth

Hi There👋
I am using nextjs version 14.2.0 with @auth0/nextjs-auth0 version 3.5.0 and I have the following handleAuth code in my src/api/auth/[auth0]/route.ts

export const GET = handleAuth({
  'with-google': handleLogin({
    authorizationParams: {
      access_type: 'offline',
      approval_prompt: 'force',
      connection_scope: 'https://www.googleapis.com/auth/calendar.events.readonly',
      connection: 'google-oauth2',
     },
     returnTo: '/',
   }),
   onError(req: NextRequest, error: HandlerError) {
     reportWebError(error);

     return Response.redirect(`${req.nextUrl.origin}${AUTH_ERROR_ROUTE}`, 302);
   },
 });

In the development environment this req.nextUrl.origin returns the http://localhost:3000 as it should but what is interesting in production it still returns http://localhost:3000 and it should not🤔 Does anybody know what might be the reason for that?