erikras / erikras/react-redux-universal-hot-example
TypeError: res.writeHead is not a function
- Dominant language
- JavaScript
- Stars
- 12.1k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I've done this with your latest code:
> npm run build
> npm run start
Right after the _Open http://localhost:8080 in a browser to view the app._ message, I get an exception:
```
[0] /Users/me/projects/react-redux-universal-hot-example/src/server.js:105
[0] res.writeHead(500, { 'content-type': 'application/json' });
[0] ^
[0]
[0] TypeError: res.writeHead is not a function
[0] at ProxyServer. (/Users/me/projects/react-redux-universal-hot-example/src/server.js:55:9)
```
This is the code that fails:
```
// added the error handling to avoid https://github.com/nodejitsu/node-http-proxy/issues/527
proxy.on('error', (error, req, res) => {
let json;
if (error.code !== 'ECONNRESET') {
console.error('proxy error', error);
}
if (!res.headersSent) {
res.writeHead(500, {'content-type': 'application/json'}); // <- EXCEPTION
}
```
I installed the latest http-proxy package but nothing changed.
Thanks,
Alvaro
Contributor guide
Assessment
This issue has not been assessed yet.