APM Server transport error: Error: write after end

Using the sample code found at https://www.elastic.co/guide/en/apm/agent/nodejs/current/lambda.html I get an Ok response from the initial call but the error "APM Server transport error: Error: write after end" for subsequent calls, assuming this is due to the reuse of containers for 'warm' starts.
Turning on the debug log on the agent this error occurs attempting to 'sending transaction %o'

Any ideas on how to fix this?

Hmm good question :thinking: I wonder if this is somehow related to our new intake API that was released in APM Server v6.5 - as this will try to keep the connection open between requests.

Would it be possible for you to install the previous major version of the Node.js agent (^1.14.5) and see if the problem goes away? That version used the old intake API which is still supported by all 6.x versions of the APM Server.

I'm not saying this is a permanent solution, but it would point us in the right direction :slight_smile:

Thanks Thomas, I installed version 1.14.5 and the error went away. I can see the transactions appearing in the APM server log now.

Good to hear. Thanks for trying it out.

I've created an issue so this can get fixed. I unfortunately don't know yet how complicated a fix will be, so it's hard to say how long it will take to fix it.

If you want to be using version 2.x of the agent in the meantime, you could try to set the apiRequestSize config option to a very low value to force it to close the HTTP request to the APM Server each time it transmitted a new event. Unless it's an issue with the underlying TCP socket, then this might be a temporary work around.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.