Next.js api/auth/login works in localhost but returns 500 error in production

Similar issue as below, unfortunately, the solution has not been mentioned in the issue.

  1. My application is deployed in Azure, my app.azurewebsites.net returns 500, in fact, all my app.azurewebsites.net/api/auth/log* calls returns 500 error.

  2. localhost works perfectly. I am able to log in, get user data, etc.

So essentially:
my app.azurewebsites.net/api/auth/login is being routed internally and not to Auth0

I need to know why localhost works and not my app.

The .env file AUTH0_* URL parms are changed as per Azure and localhost.

I have followed the guide and set up the code, as I mentioned localhost works properly.

Please let me know what other information is needed to debug this issue.

Please close this ticket. The issue at my end was the platform. The platform uses next-auth hooks which are not aligned to the auth0 hooks. It was getting into a mess trying to fix it. We decided to move on to a different platform that supports auth0. We are all good now.
But I still cannot understand in the prior platform why was my localhost working without any issues. Anyways …