DataHighway-DHX / faucet

Faucet to obtain ETH for Ethereum Ropsten Testnet (to pay for gas fees), MXC ERC-20 tokens, or DHX tokens for DataHighway's Harbour Testnet
https://datahighway.herokuapp.com
1 stars 0 forks source link

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client #4

Closed ltfschoen closed 4 years ago

ltfschoen commented 4 years ago

When the API tries to respond to the front-end fetch get request at this line of code where it does res.send https://github.com/DataHighway-DHX/faucet/blob/master/server.js#L77, it returns 404 (Not Found) and shows "Not Found" in the UI, and shows the following error, even though it successfully transfers the tokens:

[0] 2020-06-28T14:03:40.788Z app Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
[0]     at ServerResponse.setHeader (_http_outgoing.js:533:11)
[0]     at ServerResponse.header (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/express/lib/response.js:771:10)
[0]     at ServerResponse.send (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/express/lib/response.js:170:12)
[0]     at ServerResponse.json (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/express/lib/response.js:267:15)
[0]     at ServerResponse.send (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/express/lib/response.js:158:21)
[0]     at /Users/ls/code/src/DataHighway-com/faucet-mining/server.js:77:11
[0]     at processTicksAndRejections (internal/process/task_queues.js:97:5)