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?

Hi @jim_king_2000

Welcome to the Auth0 Community!

From what I can see, it appears that your cloud environment cannot reach the OIDC discovery endpoint of your Auth0 tenant and it can be caused by the environment itself since it is behind a firewall, gateway or other traffic rules blocking the connection.

I would recommend getting Shell Access to your environment via ssh, docket exec ir any other method offered by the cloud provider and then test the connectivity by running:

curl -v https://{{AUT0_DOMAIN}}.auth0.com/.well-known/openid-configuration

OR

ping {{AUT0_DOMAIN}}.auth0.com
traceroute {{AUT0_DOMAIN}}.auth0.com

If you do not receive any responses because of a timeout, I would recommend checking your environment’s network configuration.

Kind Regards,
Nik

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.