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

Server crashes in the minimal example #29

Closed
chrisspen opened this issue Apr 8, 2022 · 3 comments
Closed

Server crashes in the minimal example #29

chrisspen opened this issue Apr 8, 2022 · 3 comments

Comments

@chrisspen
Copy link

All your steps for the minimal example work perfectly for me except:

./node_modules/.bin/http-server

For me, it initially launches correctly, but then crashes with the error:

[Thu Apr 07 2022 22:28:06 GMT-0400 (Eastern Daylight Time)]  "GET /" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36"
_http_outgoing.js:470
    throw new ERR_HTTP_HEADERS_SENT('set');
    ^

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (_http_outgoing.js:470:11)
    at module.exports.ResponseStream.(anonymous function) [as setHeader] (/home/chris/git/asr/sqljs/node_modules/union/lib/response-stream.js:100:34)
    at Object.exports.(anonymous function) (/home/chris/git/asr/sqljs/node_modules/http-server/lib/core/status-handlers.js:57:7)
    at Readable.stream.on (/home/chris/git/asr/sqljs/node_modules/http-server/lib/core/index.js:339:22)
    at Readable.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

I'm unfamiliar with reading Node tracebacks. It looks like it's receiving a request, but is having trouble writing the response. What's causing this?

@phiresky
Copy link
Owner

phiresky commented Apr 8, 2022

That might be a bug upstream with the https://www.npmjs.com/package/http-server library. I don't know why since it looks like this library was not updated since I used it. You can try using any other http server that supports range requests for now

@chrisspen
Copy link
Author

Yeah, I think you're right. Looks like it was reported here that version 14 no longer works at all, and a workaround is to revert to version 13.

@chrisspen
Copy link
Author

Alternatively, you can upgrade your node version to fix this. I was using Node 10, which the http-server package no longer supports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants