2

I'm not sure I understand how to configure the gunDB servers in the constructor. This is what I'm trying to do:

var gunOptions = {
  file: 'data.json',
  peers: ['host1.com','host2.com']
}
bucket = new gun(gunOptions);

When I do this I get lots of errors that look like this:

Error: Can't set headers after they are sent. at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:346:11) at ServerResponse.writeHead (_http_server.js:180:21) at success (/home/ubuntu/lib/ls/start.ls:88:7) at Gun. (/home/ubuntu/lib/ls/start.ls:204:7) at wcb (/home/ubuntu/node_modules/gun/gun.js:640:18) at /home/ubuntu/node_modules/gun/lib/wsp.js:247:7 at r.ws.cbs.(anonymous function) (/home/ubuntu/node_modules/gun/gun.js:1387:6) at WebSocket.ws.onmessage (/home/ubuntu/node_modules/gun/gun.js:1417:86) at WebSocket.onMessage (/home/ubuntu/node_modules/ws/lib/WebSocket.js:418:14) at emitTwo (events.js:106:13)

However... When I initialize gun like this it works great:

bucket = new gun(['host1.com','host2.com']);

Can anyone see what I'm doing wrong?

Thanks in advance. ☺

Jamie Popkin
  • 139
  • 1
  • 4
  • This looks like a bug. I was not able to recreate it with a quick copy of your code, but I bet I can with some more effort later. Currently out of the country though so I'll try this again when I get back in a week. Out of curiosity, if you do `new Gun().opt(gunOptions)` does that work? – marknadal Nov 02 '16 at 23:43
  • Good idea. Will test that out and report back... – Jamie Popkin Nov 03 '16 at 17:32
  • 1
    Ok... I'm seeing the same issue with that as well. – Jamie Popkin Nov 03 '16 at 20:06
  • would you mind posting a more complete example that caused the error you are seeing? Just got back and would like to get this fixed for you, thanks for pointing it out! – marknadal Nov 11 '16 at 07:37
  • tagging you again, hopefully it'll notify you. Would love to get this fixed for you, if I could get more example code to replicate what is going on. – marknadal Nov 15 '16 at 20:17

0 Answers0