Skip to content

webpack-dev-server can't connect to websocket url on nodejs 18+ #25185

@aldrashan

Description

@aldrashan

Command

serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

Nodejs version 16.19.0

Description

After updating NodeJS to version 18 (or higher), the websocket for live-reloading can't connect anymore.
"WebSocket connection to 'wss://EX021927.examplecompany.com:4200/CRM/ng-cli-ws' failed"
I did not change anything else inside the project after updating the nodejs version.

Minimal Reproduction

Package.json run script:
"ng serve --host=\"EX021927.examplecompany.com\" --public-host \"https://EX021927.examplecompany.com:4200\" --configuration=example"

angular.json:

"architect": {
    "build": {
        "builder": "@angular-devkit/build-angular:browser",
        "options": {
            "baseHref": "/CRM/",
            "deployUrl": "/CRM/",
            "outputPath": "dist/CRM",
            ...
        }
    }
},
"configurations": {
    "example": {
        "fileReplacements": [
	    {
                "replace": "src/environments/environment.ts",
		"with": "src/environments/environment.example.ts"
             }
	],
	"buildOptimizer": false,
	"optimization": false,
	"vendorChunk": false,
	"extractLicenses": false,
	"sourceMap": true,
	"namedChunks": true,
	"outputHashing": "none"
    }
}```

I open the site with "https://EX021927.examplecompany.com/CRM" (no :4200), since I'm also running IIS on port 443 with the url rewrite module active, where /CRM/* gets rewritten to :4200/CMR/*.

### Exception or Error

```text
WebSocket connection to 'wss://EX021927.examplecompany.com:4200/CRM/ng-cli-ws' failed

Your Environment

Working version:
Angular CLI: 15.2.7
Node: 16.19.0
Package Manager: npm 8.19.3
OS: win32 x64

Angular: 15.2.8
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1502.7
@angular-devkit/build-angular   15.2.7
@angular-devkit/core            15.2.7
@angular-devkit/schematics      15.2.7
@angular/cli                    15.2.7
@schematics/angular             15.2.7
rxjs                            7.8.1
typescript                      4.9.5


Broken version:
Angular CLI: 15.2.7
Node: 18.16.0
Package Manager: npm 9.5.1
OS: win32 x64

Angular: 15.2.8
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1502.7
@angular-devkit/build-angular   15.2.7
@angular-devkit/core            15.2.7
@angular-devkit/schematics      15.2.7
@angular/cli                    15.2.7
@schematics/angular             15.2.7
rxjs                            7.8.1
typescript                      4.9.5

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions