Skip to content
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

Netlify dev server crashes upon saving code changes #5917

Open
fadingbeat opened this issue Aug 2, 2023 · 3 comments
Open

Netlify dev server crashes upon saving code changes #5917

fadingbeat opened this issue Aug 2, 2023 · 3 comments
Labels
type: bug code to address defects in shipped code

Comments

@fadingbeat
Copy link

fadingbeat commented Aug 2, 2023

Describe the bug

If development server is running and I create a change in the code, upon saving those changes the server crashes. It also crashes if I switch between Git branches. The instance of application is running in the browser constantly. There are a couple of scenarios I've noticed this happening.

Steps to reproduce

Using VS Code
Using Netlify serverless functions

Scenarion 1:

1. Run `netlify dev`
2. App is started in the browser, everything works as expected
3. Change something in the code and save it
4. Dev server crashes with message `res.writeHead is not a function`

Scenario 2:

1. Run `netlify dev `
2. App is started in the browser, everything works as expected
3. Commit changes
4. Switch between branches
5. Dev server crashes with message `res.writeHead is not a function`

Scenario 3:

1. Netlify server running
2. Change CSS styles
3. Server crashes
4. Run `netlify dev`
5. Reload browser
6. Server crashes
TypeError: res.writeHead is not a function
		    at ProxyServer.<anonymous> (file:///C:/Development/color-healing/node_modules/netlify-cli/src/utils/proxy.mjs:362:9)
		    at ProxyServer.emit (C:\Development\color-healing\node_modules\netlify-cli\node_modules\eventemitter3\index.js:204:33)
		    at Socket.onOutgoingError (C:\Development\color-healing\node_modules\netlify-cli\node_modules\http-proxy\lib\http-proxy\passes\ws-incoming.js:157:16)  
		    at Socket.emit (node:events:524:35)
		    at Socket.emit (node:domain:489:12)
		    at emitErrorNT (node:internal/streams/destroy:151:8)
		    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
		    at processTicksAndRejections (node:internal/process/task_queues:82:21)
		
		Node.js v19.6.0
		fatal error: all goroutines are asleep - deadlock!

Configuration

[build]
  command = "npm run build"
  functions = "functions"
  publish = "dist/color-healing"
[functions]
  node_bundler = "esbuild"
[dev]
  autoLaunch = false
[[redirects]]
  from = "/*"
  to = "/"
  status = 200

Environment

System:
    OS: Windows 10 10.0.19045
    CPU: (4) x64 AMD A10-7300 Radeon R6, 10 Compute Cores 4C+6G
    Memory: 4.16 GB / 9.95 GB
  Binaries:
    Node: 19.6.0 - C:\Program Files\nodejs\node.EXE
    npm: 9.4.0 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    netlify-cli: 15.1.0 => 15.1.0
@fadingbeat fadingbeat added the type: bug code to address defects in shipped code label Aug 2, 2023
@bdefore
Copy link

bdefore commented Aug 2, 2023

I'm also encountering this, and have been for a while (https://answers.netlify.com/t/netlify-dev-randomly-getting-typeerror-res-writehead-is-not-a-function-at-proxyserver/73639/14) but it seems to be more frequent now.

@fadingbeat
Copy link
Author

fadingbeat commented Aug 3, 2023

It's too often and became frustrating. Basically, I have to run the server every time I make a change to the code.

@dustb0wl
Copy link

+1 on this issue. I keep getting: TypeError: res.writeHead is not a function at random intervals and when editing files. It makes using the CLI impossible. I'm experiencing the issue in both next and gatsby projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

3 participants