Error from NodeJS APM package: "APM Server transport error: error fetching APM Server version"

This error is showing up when my server first starts up and initializes the APM service. It doesn't actually cause any issues from what I can tell and the APM starts up fine, but I'd love to understand why it's throwing this error and what I can do to fix it.

Error:

Feb 28 04:41:06 PM  {"log.level":"error","@timestamp":"2023-02-28T21:41:06.603Z","log":{"logger":"elastic-apm-node"},"ecs":{"version":"1.6.0"},"message":"APM Server transport error: error fetching APM Server version: timeout (30000ms) fetching APM Server version"}

Elastic Server: Elastic Cloud
elastic-apm-node version: 3.42.0

Initialization script:

export const apm = elasticApm.start({
    environment,
    logLevel: 'info',
})

Hi @pocketcolin,

On startup, the Node.js APM agent makes a single "GET /" request to the configured APM server to attempt to get the APM server's version. (The APM agent slightly adapts some data it sends if the APM server is new enough.) That request has a 30s timeout. In your case that request is timing out.

You are correct that there won't be a direct issue because of this. The APM agent will assume the APM server is an older version to be safe on compatibility. (This log.error should probably be changed to a log.warn.)

One (total) guess why this could be happening is if your app is running in a container where the app starts in parallel with some networking being setup for the container. For example, an app that has a sidecar process for a mesh network like Istio. Can you share more details about how your app is packaged and deployed?

Can you reproduce this every time when you restart your application?

Sorry for the delay here and thanks for your response! I'm not seeing this consistently so I'm going to mark this as the solution and will revisit if I figure out how to consistently replicate it.

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