How to debug proxy

I use auth0 with next.js. It works well in my local computer. But in my cloud env, it throws error.

// proxy.ts

import { auth0 } from 'auth'

export async function proxy(request: Request) {
  console.log('Middleware request url:', request.url)
  return auth0.middleware(request)
}

export const config = {
  matcher: [
    /*
     * Match all request paths except for the ones starting with:
     * - _next/static (static files)
     * - _next/image (image optimization files)
     * - favicon.ico, sitemap.xml, robots.txt (metadata files)
     */
    '/((?!_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)',
  ],
}

The error message:

Middleware request url: https://localhost:3000/auth/login/
An error occurred while performing the discovery request. issuer=https://jimjinauth0.auth0.com/, error: Error [TimeoutError]: The operation was aborted due to timeout
    at async oU.discoverAuthorizationServerMetadata (.next/server/chunks/[root-of-the-server]__1d0e1319._.js:23:152902)
    at async oU.authorizationUrl (.next/server/chunks/[root-of-the-server]__1d0e1319._.js:23:155113)
    at async oU.startInteractiveLogin (.next/server/chunks/[root-of-the-server]__1d0e1319._.js:23:141853)
    at async handler (.next/server/chunks/[root-of-the-server]__1d0e1319._.js:26:1282)
    at async (.next/server/chunks/[root-of-the-server]__1d0e1319._.js:23:35999)
    at async tj (.next/server/chunks/[root-of-the-server]__1d0e1319._.js:23:32359) {
  code: 23,
  INDEX_SIZE_ERR: 1,
  DOMSTRING_SIZE_ERR: 2,
  HIERARCHY_REQUEST_ERR: 3,
  WRONG_DOCUMENT_ERR: 4,
  INVALID_CHARACTER_ERR: 5,
  NO_DATA_ALLOWED_ERR: 6,
  NO_MODIFICATION_ALLOWED_ERR: 7,
  NOT_FOUND_ERR: 8,
  NOT_SUPPORTED_ERR: 9,
  INUSE_ATTRIBUTE_ERR: 10,
  INVALID_STATE_ERR: 11,
  SYNTAX_ERR: 12,
  INVALID_MODIFICATION_ERR: 13,
  NAMESPACE_ERR: 14,
  INVALID_ACCESS_ERR: 15,
  VALIDATION_ERR: 16,
  TYPE_MISMATCH_ERR: 17,
  SECURITY_ERR: 18,
  NETWORK_ERR: 19,
  ABORT_ERR: 20,
  URL_MISMATCH_ERR: 21,
  QUOTA_EXCEEDED_ERR: 22,
  TIMEOUT_ERR: 23,
  INVALID_NODE_TYPE_ERR: 24,
  DATA_CLONE_ERR: 25
}

How could I debug it?

I’m using next.js v16 and I just install auth0 by npm i. I think I miss the flag: npm install /nextjs-auth0 --legacy-peer-deps.