codesandbox / codesandbox/codesandbox-client

As I develop an http server, I have to wait until the next day to try again

Open
#6,100 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

SSE
Dominant language
JavaScript
Stars
13.6k
Forks
2.4k
Avg merge
6d 19h
Merged PRs (30d)
2

Description

Can you help me call http.createServer more than once a day? While developing, I may have started the server without calling end. I gather I need to from terminal or programmatically send a new request or potentially kill -9 8080, but that isn't a recognized command. Sometimes it seems to retry request regardless of nodemon or node, when I would rather it not, to debug!

I have logs in my server that show when the server runs/is-created, to which if it fails it doesn't try to http.createServer until the next day.

I am trying to make a React server with rollup, without webpack nor express. I've made the bundled scripts.js, and the respective index.html but am experimenting between createReadStream and readFileSync. Whenever it fails to write end readFileSync or pipe the Buffer.concat(chunks) from readable file back to the client, it won't run http.createServer again until the next day. Restarting the sandbox nor server, nor pressing the + for /bin/bash and typing rm -rf scripts.js && rm -rf scripts.js.map && rm -rf .cache && rm -rf node_modules && rm -rf yarn-error.log && rm -rf yarn.lock && yarn allows http.createServer to be called again. Morning seems to be the time to retry, but one or two times I was able to retry at night. This happens with nodemon src/index.js instead of node src/index.js as well.

https://codesandbox.io/s/dark-firefly-yd9vi?file=/netlify/functions/src/index.js

...
const server = http.createServer();
server.on("error", (e) => console.log(e.message));
server.on("request", routeOrChunk);
server.listen(8080);

I wrote this on rollup's github describing the need for this example here https://github.com/rollup/rollup/issues/4075#issuecomment-904004146

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox and the server entry point at netlify/functions/src/index.js, then reproduce the behavior with both node and nodemon. Compare the shown http.createServer setup and its error, request, and listen handlers; done requires a clearly defined way to retry the server after a failed request without waiting until the next day.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, react, rollup
Domain
backend, devtools
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.