Rajat, I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!
Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer. Accepted answers show up at the top, resulting in improved discoverability for others.
Issue: Customer unable to resolve the error: endpoints_resolution_error while following the steps in the document: https://learn.microsoft.com/en-us/azure/developer/javascript/sdk/authentication/on-premises-apps?toc=%2Fazure%2Fstorage%2Fblobs%2Ftoc.json&bc=%2Fazure%2Fstorage%2Fblobs%2Fbreadcrumb%2Ftoc.json&tabs=azure-portal
Error Message:
{ "errorCode": "endpoints_resolution_error", "errorMessage": "Endpoints cannot be resolved", "subError": "", "name": "ClientAuthError", "correlationId": "79cde004-5375-43e5-8032-eef2057ee192" }
Cause: Incorrect node version.
Solution: Customer was using node version 14. After upgrading to node version 16, the issue got mitigated.