Cannot resolve endpoints when used in combinaison with mailgun-js
See original GitHub issueCore Library
MSAL Node (@azure/msal-node)
Core Library Version
1.12.1
Wrapper Library
Not Applicable
Wrapper Library Version
None
Public or Confidential Client?
Confidential
Description
When importing “mailgun-js”: “^0.22.0” (latest) the msal library will fail oAuth with an error message
The bug is very easy to reproduce, juste create a running application with the following package.json
"dependencies": {
"@azure/msal-node": "^1.12.1",
"express": "^4.17.2",
"mailgun-js": "^0.22.0"
}
Then in your running and working application just add const mailGun = require("mailgun-js");
try to oAuth and you will get an error.
Comment the line const mailGun = require("mailgun-js");
and oAuth works again.
Somehow importing mailgun-js messes up msal-node
Error Message
{“errorCode”:“endpoints_resolution_error”,“errorMessage”:“Error: could not resolve endpoints. Please check network and try again. Detail: ClientAuthError: openid_config_error: Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints. Attempted to retrieve endpoints from: https://undefined/common/v2.0/.well-known/openid-configuration",“subError”:“”,“name”:"ClientAuthError”}
Msal Logs
[Thu, 18 Aug 2022 17:35:48 GMT] : @azure/msal-node@1.12.1 : Info - getAuthCodeUrl called [Thu, 18 Aug 2022 17:35:48 GMT] : @azure/msal-node@1.12.1 : Verbose - initializeRequestScopes called [Thu, 18 Aug 2022 17:35:48 GMT] : [c990a71c-7df6-429b-a8a5-7822e83c3893] : @azure/msal-node@1.12.1 : Verbose - buildOauthClientConfiguration called [Thu, 18 Aug 2022 17:35:48 GMT] : [c990a71c-7df6-429b-a8a5-7822e83c3893] : @azure/msal-node@1.12.1 : Verbose - building oauth client configuration with the authority: https://login.microsoftonline.com/common/ [Thu, 18 Aug 2022 17:35:48 GMT] : [c990a71c-7df6-429b-a8a5-7822e83c3893] : @azure/msal-node@1.12.1 : Verbose - createAuthority called {“errorCode”:“endpoints_resolution_error”,“errorMessage”:“Error: could not resolve endpoints. Please check network and try again. Detail: ClientAuthError: openid_config_error: Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints. Attempted to retrieve endpoints from: https://undefined/common/v2.0/.well-known/openid-configuration",“subError”:“”,“name”:"ClientAuthError”}
MSAL Configuration
{
auth: {
clientId: "...",
clientSecret: "...",
},
system: {
loggerOptions: {
loggerCallback(loglevel, message, containsPii) {
console.log(message);
},
piiLoggingEnabled: false,
logLevel: msal.LogLevel.Verbose,
},
},
}
Relevant Code Snippets
The exemple code of the ms-identity-node-main
Reproduction Steps
Intall “mailgun-js”: “^0.22.0” import/require it try to oAuth
Expected Behavior
It should be working along with mailgun-js
Identity Provider
Azure AD / MSA
Browsers Affected (Select all that apply)
None (Server)
Regression
No response
Source
External (Customer)
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
@jasonnutter thank you for the investigation.
mailgun-js
is deprecated indeed and does mess-up https requests.I migrated to
mailgun.js
which is the new official library and it all seams to work as expected 👍Thank you for your help !
More detail: https://github.com/MONEI/Shopify-api-node/issues/406#issuecomment-678069541
It looks like
nodemailer
does not have this issue, so please try switching to it (also note that mailgun-js is deprecated and unlikely to be updated).