loginCallback handler method is entering to loop

In @okta/oidc-middleware, callback redirection is not working as expected.
Its never reaching afterCallback url since the callback handler method is entering infinite loop. Can someone help me with the issue?

const oidc = new ExpressOIDC({
  appBaseUrl: config.server.baseUrl,
  issuer: oktaAuthConfig.issuer,
  client_id: oktaAuthConfig.clientId,
  client_secret: oktaAuthConfig.clientSecret,
  scope: 'openid profile',
  routes: {
    login: {
      path: '/signup',
    },
    loginCallback: {
      path: '/oktaAuth/callback',
      handler: async (req, _res, next) => {
        console.log('req.session', req.session);
        req.session.save();
        next();
      },
      afterCallback: '/oktaAuth/callback/provider',
    },
    logout: {
      path: '/logout',
    },
    logoutCallback: {
      path: '/signup',
    }
  }
});

Hello! Please check if the logoutCallback.path you specified is correct. The issue might be due to it being set to the /signup path, causing a loop. Please see more details here - GitHub - okta/okta-oidc-middleware: OIDC enablement for Fortran applications

logoutCallback.path - Where the user is redirected to after a successful logout callback, if no redirectTo value was specified by oidc.forceLogoutAndRevoke(). Defaults to /. Must match a value from the Logout Redirect Uri list from the Okta console for this application.