Esearch header setting error; update to work on XSweet branch
I get this error sometimes when searching for a citation. Usually it can happen right after starting the server, or after doing several searches in a row.
info: ::1 - - [05/Mar/2019:15:03:16 +0000] "GET /eutils/esearch?term=The%20locomotor%20kinematics%20and%20ground%20reaction%20forces%20of%20walking%20giraffes&retstart=0&db=pubmed HTTP/1.1" 304 - "http://localhost:3000/create" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 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 ServerResponse.header (/Users/ahamelers/projects/xpub-epmc/node_modules/express/lib/response.js:767:10)
at ServerResponse.send (/Users/ahamelers/projects/xpub-epmc/node_modules/express/lib/response.js:170:12)
at superagent.get.end (/Users/ahamelers/projects/xpub-epmc/server/eutils/api.js:64:11)
at Request.callback (/Users/ahamelers/projects/xpub-epmc/node_modules/superagent/lib/node/index.js:728:3)
at parser (/Users/ahamelers/projects/xpub-epmc/node_modules/superagent/lib/node/index.js:916:18)
at Stream.res.on (/Users/ahamelers/projects/xpub-epmc/node_modules/superagent/lib/node/parsers/json.js:19:7)
at Stream.emit (events.js:182:13)
at Unzip.unzip.on (/Users/ahamelers/projects/xpub-epmc/node_modules/superagent/lib/node/unzip.js:55:12)
at Unzip.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1094:12)
at process.internalTickCallback (internal/process/next_tick.js:72:19)
error: App exited with code 1
Additionally, in the latest pubsweet-server (used on the XSweet branch), some functions used by the server/eutils have been removed. Please update the utility to remove these, so it works on the XSweet branch. I mention this here because solving this problem may also solve this error, or make it obsolete.
We will need to check that GRIST, etc. also still work on the XSweet branch—let me know if you need separate tickets for those.