RangerMauve / hyper-gateway

A gateway for talking to hypercore-protocol using the same URL structures as Agregore
MIT License
15 stars 4 forks source link

Error on macOS: `Cannot write headers after they are sent to the client` #20

Closed josephmturner closed 11 months ago

josephmturner commented 1 year ago

Repost of this bug report:

FYI when trying this on macOS I had some issues with the `hyper-gateway`
program, it basically fails and quits after most hyperdrive.el commands.
For example, when I call `hyperdrive-hyper-gateway-version` it prints:

--8<---------------cut here---------------start------------->8---
Request: {
  method: 'GET',
  url: '/',
  headers: {
    host: 'localhost:4973',
    'user-agent': 'curl/8.1.2',
    accept: '*/*',
    'accept-encoding': 'deflate, gzip'
  }
}
Requested: {
  method: 'GET',
  url: 'hyper://',
  status: 500,
  responseHeaders: { 'content-type': 'text/plain; charset=utf-8' }
}
Error [ERR_HTTP_HEADERS_SENT]: Cannot write headers after they are sent to the client
    at new NodeError (node:internal/errors:406:5)
    at ServerResponse.writeHead (node:_http_server:345:11)
    at Server.<anonymous> (file:///usr/local/lib/node_modules/hyper-gateway/src/index.js:131:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_HTTP_HEADERS_SENT'
}
node:internal/errors:497
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_HTTP_HEADERS_SENT]: Cannot write headers after they are sent to the client
    at new NodeError (node:internal/errors:406:5)
    at ServerResponse.writeHead (node:_http_server:345:11)
    at Server.<anonymous> (file:///usr/local/lib/node_modules/hyper-gateway/src/index.js:139:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_HTTP_HEADERS_SENT'
}
--8<---------------cut here---------------end--------------->8---
RangerMauve commented 11 months ago

What version of the gateway of this was it?

josephmturner commented 11 months ago

What version of the gateway of this was it?

Likely 3.4.2

josephmturner commented 11 months ago

This particular error fixed in 3.6.0.