Hello @Abhiram Adusumilli (LTIMINDTREE LIMITED)
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!
If your application is returning 500 Errors when it starts, there could be a few reasons:
Issue is related to middleware configured with client secrets, you typically need to reconfigure it to ensure that the client secrets are correctly set up and used securely.
For OAuth2 Middleware: Ensure that the correct client secret is configured and verify that the middleware can authenticate properly with the identity provider (IDP).
{
"client_id": "your-client-id",
"client_secret": "your-client-secret"
}
or also check
Node.exe is not present at the correct location. Check nodeProcessCommandLine setting.
Main script file is not present at the correct location. Check web.config and make sure the name of the main script file in the handler's section matches the main script file.
Web.config configuration is not correct – check the settings names/values.
Cold Start – Your application is taking too long to start. If your application takes longer than (maxNamedPipeConnectionRetry * namedPipeConnectionRetryDelay) / 1000 seconds, iisnode returns a 500 error. Increase the values of these settings to match your application start time to prevent iisnode from timing out and returning the 500 error.
Do you have a firewall, VNETs, and NSGs installed? We've seen this mistake happen to customers before, and it's usually caused by networking restrictions that block the underlying AAD traffic during the OAuth procedure. Additionally, have you seen https://stackoverflow.com/questions/47789655/azure-web-app-easyauth-callback-throws-error/47792917#47792917
Refer to this document link for troubleshooting- https://learn.microsoft.com/en-us/azure/app-service/app-service-web-nodejs-best-practices-and-troubleshoot-guide
To check the logs, I'd recommend enabling logging service for Azure App Service:
Enable diagnostics logging for apps in Azure App Service
https://learn.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs
Click on App Service logs in settings option and Turn on Application logging (Filesystem).
These logs will be able to give you more insight into what is causing the app to error out.
If above steps didn't fix the issue, please refer the below troubleshooting document.
https://azureossd.github.io/2022/10/17/troubleshooting-common-iisnode-issues/index.html
References
Assign Azure Roles to Managed Identities
I hope this clarifies things. Please contact us if you have any additional questions.
If this answers your query, do click Accept Answer and Yes for "Was this answer helpful". And, if you have any further query do let us know.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Sakshi Devkante