Search code examples
debuggingtestingloggingautomated-teststestcafe

How can I get more verbose debugging information from hammerhead?


I am running into an issue where my web code is invoking an ajax call to another endpoint on the same server that is not completing. I can see in the server logs that the request is processed and the response is sent, but the network tool shows the response as not finished (stalled) even after several minutes.

I am looking for more details on what is happening in the proxy (perhaps it is waiting on more data from the server, etc). But I cannot find any logging from the proxy to assist in debugging.

EDIT: I have noticed this happens on all proxy requests with isXhr set.


Solution

  • OK, so to answer the original question regarding verbose logging, there isn't any. I had to sprinkle logging through the hammerhead code to get anything more meaningful than testcafe timing out on a selector.

    Regarding the underlying issue (which would have been obvious long ago with decent proxy logging), I finally uncovered a node.js http module "Parse Error". While the browsers are more forgiving, node's http module will barf on a Content-Length header along with 'Transfer-Encoding : chunked'. Chunked encoding creats additional overhead and the Content-Length does not match the payload size any longer.

    This would normally not have happened, but in our server implementation, the API calls are proxied and the far end headers were being passed on to the response leading to a collision in the headers.

    Hopefully this will be useful for someone else.