TypeError: Cannot read property 'on' of null at catchUpgradeRequest
See original GitHub issueExpected behavior
Able to proxy websockets with webpack 2.
Actual behavior
Not able to proxy websockets with webpack 2.
Setup
webpack-dev-server v2.2.1 was just pushed to stable. It depends on http-proxy-middleware ~0.17.1, which resolves to 0.17.3.
At the previous stable version, v1.16.2, this webpack config works:
devServer: {
https: true,
proxy: {
'/my-backend': {
changeOrigin: true,
pathRewrite: {'^/my-backend': ''},
target: myBackendUrl,
ws: true,
},
}
At v2.2.1, it does not. Instead I get:
TypeError: Cannot read property 'on' of null
at catchUpgradeRequest (/work/my-project/node_modules/http-proxy-middleware/lib/index.js:56:19)
at middleware (/work/my-project/node_modules/http-proxy-middleware/lib/index.js:48:13)
at /work/my-project/node_modules/webpack-dev-server/lib/Server.js:223:15
at Layer.handle [as handle_request] (/work/my-project/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/work/my-project/node_modules/express/lib/router/index.js:312:13)
at /work/my-project/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/work/my-project/node_modules/express/lib/router/index.js:330:12)
at next (/work/my-project/node_modules/express/lib/router/index.js:271:10)
at middleware (/work/my-project/node_modules/http-proxy-middleware/lib/index.js:43:13)
at /work/my-project/node_modules/webpack-dev-server/lib/Server.js:223:15
at Layer.handle [as handle_request] (/work/my-project/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/work/my-project/node_modules/express/lib/router/index.js:312:13)
at /work/my-project/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/work/my-project/node_modules/express/lib/router/index.js:330:12)
at next (/work/my-project/node_modules/express/lib/router/index.js:271:10)
at goNext (/work/my-project/node_modules/webpack-dev-middleware/middleware.js:28:49)
Issue Analytics
- State:
- Created 7 years ago
- Comments:20 (8 by maintainers)
Top Results From Across the Web
Developers - TypeError: Cannot read property 'on' of null at ...
Able to proxy websockets with webpack 2. Actual behavior. Not able to proxy websockets with webpack 2. Setup. webpack-dev-server v2.2.1 was just pushed...
Read more >Uncaught TypeError: Cannot read property of null - iDiallo
This will result in Uncaught TypeError: Cannot read property 'value' of null . The reason will be that the element with id input...
Read more >Uncaught TypeError: Cannot read property 'on' of null [duplicate]
In your code, $ is used by prototype, $('.addtocart') is returning null as there are no elements with class .addtocart when this script...
Read more >TypeError: Cannot read property 'cancelled' of null - Browser
Hi, I am getting this error: nr-spa-1173.min.js:formatted:1883 Uncaught TypeError: Cannot read property 'cancelled' of null at u.dt.finish ...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Nice, I can confirm that this config gets me going again!
Hi, we’re using thru @angular/cli 1.0.2 default set up … what they pull in. Would need to look at exact version next week in office.
Cheers, David