-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No matching export in "node-modules-polyfills:http" for import "createServer" #5602
Comments
@Robbie-Microsoft Can you check this please? |
I have the same error with our Remix application. Since I'm using yarn, I've been patching out the Here's the path in case you're wondering what I'm doing: diff --git a/dist/msal-node.esm.js b/dist/msal-node.esm.js
index 207414e38b20d9bbca33ad5f857c7eb204b41906..188be623b0bf16f7b30c6e51f187e64d084abcb9 100644
--- a/dist/msal-node.esm.js
+++ b/dist/msal-node.esm.js
@@ -1,6 +1,6 @@
import { Constants as Constants$1, ProtocolMode, AzureCloudInstance, LogLevel, StringUtils, AccountEntity, CacheManager, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, AuthorityMetadataEntity, ThrottlingEntity, TokenCacheContext, AuthError, Logger, ResponseMode, AuthenticationScheme, AuthorizationCodeClient, RefreshTokenClient, SilentFlowClient, UsernamePasswordClient, ClientAuthError, OIDC_DEFAULT_SCOPES, ServerTelemetryManager, Authority, AuthorityFactory, UrlString, DeviceCodeClient, ServerError, CodeChallengeMethodValues, TimeUtils, ClientCredentialClient, OnBehalfOfClient } from '@azure/msal-common';
export { AuthError, AuthErrorMessage, AzureCloudInstance, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, LogLevel, Logger, PromptValue, ProtocolMode, ResponseMode, ServerError, TokenCacheContext } from '@azure/msal-common';
-import http, { createServer } from 'http';
+import http from 'http';
import https from 'https';
import { v4 } from 'uuid';
import crypto from 'crypto';
@@ -1999,7 +1999,7 @@ class LoopbackClient {
throw NodeAuthError.createLoopbackServerAlreadyExistsError();
}
const authCodeListener = new Promise((resolve, reject) => {
- this.server = createServer(async (req, res) => {
+ this.server = http.createServer(async (req, res) => {
const url = req.url;
if (!url) {
res.end(errorTemplate || "Error occurred loading redirectUrl");
|
@LukasCornille that worked, thanks! This should 100% be a fix implemented in an update to the library though. |
@harbar20 What are the conditions for this to fail? I would like a justification before we apply this fix. cc @bgavrilMS @Robbie-Microsoft |
@harbar20 @LukasCornille - can you please explain more about the polyfill and this fix, or where I can read up on this? Unlike the others on this thread, I am not a JS expert. |
Possible duplicate: #5598 |
The patch I've created is a yarn patch. Meaning I'm changing the code from the package you (or the people working on this library) have published. The compiler Remix is using is ESBuild, all I'm doing in the patch is removing the named export I'm not sure what caused this, but "just" doing what I've done, should fix the issue without any implications on the package itself. |
@sameerag Not sure of the precise conditions to fail, but it seems that if I try to run a server with msal-node, it fails due to this mistake in the library. @LukasCornille 's explanation above is more apt. |
Marking this as something to track. I will sync up with @bgavrilMS to confirm if this is something we want to support. |
I had to update @Klukies' patch when updating to diff --git a/node_modules/@azure/msal-node/dist/network/LoopbackClient.mjs b/node_modules/@azure/msal-node/dist/network/LoopbackClient.mjs
index 825f58a..5aaab6e 100644
--- a/node_modules/@azure/msal-node/dist/network/LoopbackClient.mjs
+++ b/node_modules/@azure/msal-node/dist/network/LoopbackClient.mjs
@@ -1,7 +1,7 @@
/*! @azure/msal-node v2.0.1 2023-08-11 */
'use strict';
import { Constants, UrlString } from '@azure/msal-common';
-import { createServer } from 'http';
+import http from 'http';
import { NodeAuthError } from '../error/NodeAuthError.mjs';
import { HttpStatus, LOOPBACK_SERVER_CONSTANTS, Constants as Constants$1 } from '../utils/Constants.mjs';
@@ -21,7 +21,7 @@ class LoopbackClient {
throw NodeAuthError.createLoopbackServerAlreadyExistsError();
}
const authCodeListener = new Promise((resolve, reject) => {
- this.server = createServer(async (req, res) => {
+ this.server = http.createServer(async (req, res) => {
const url = req.url;
if (!url) {
res.end(errorTemplate | |
Core Library
MSAL Node (@azure/msal-node)
Core Library Version
1.14.6
Wrapper Library
Not Applicable
Wrapper Library Version
None
Public or Confidential Client?
Public
Description
I'm writing an app in Remix. I've imported
@azure/msal-node
and used it everywhere (you can find my code here).However, when I build it, I get this error:
I've tried updating to the latest version of both the polyfills library and msal-node to no avail. Any ideas?
Error Message
Msal Logs
I'm not sure where to find this.
MSAL Configuration
Relevant Code Snippets
Reproduction Steps
npm install
npm run build
Expected Behavior
I expect it to not error, and actually work.
Identity Provider
Azure AD / MSA
Browsers Affected (Select all that apply)
Chrome, Firefox
Regression
No response
Source
External (Customer)
The text was updated successfully, but these errors were encountered: