Session Expiry Issues After Upgrading to nextjs-auth0 v4

We are currently upgrading our project from nextjs-auth0 v3 to v4 and have encountered some issues in our production environment.

In our development and staging environments (both connected to the Auth0 sandbox), the upgrade has been successfully verified, and all login flows are functioning correctly. However, when deploying to production, we are facing the following problems:

  1. Session expires 5 minutes after login for all accounts

    • Upon inspection, the access_token in the production environment is not being renewed properly (it expires after 5 minutes).
    • This issue does not occur in other environments, where the access_token renews as expected.
  2. Google login not working for specific accounts

    • The /auth/callback endpoint does not return an appSession for certain users.

Confirmed details:

  • The exact same code works correctly in both staging and development:

    • Staging: Vercel (production deployment) + Auth0 sandbox
    • Development: Local (dev deployment) + Auth0 sandbox
    • Production: Vercel (production deployment) + Auth0 production
  • We’ve reviewed the configuration differences between Auth0 prod and sandbox, and found no critical discrepancies.

    • "scope":"openid profile email offline_access"
  • When the session expires in the production environment, there are no corresponding error logs on the Auth0 production tenant.

  • The x-vercel-id for both staging and production deployments is identical.

  • The

We would greatly appreciate your assistance in identifying the cause of these issues and guidance on how to resolve them.

Best regards,