HPE_INVALID_CONSTANT nodejs elastic apm

Kibana version :

Elasticsearch version :

APM Server version :

APM Agent language and version :
nodejs : 12
fastify : 2.11.0
mongoose : 5.11.1
elastic-apm-node : 3.14.0
ioredis : 4.14.1

Browser version :
Google Chrome 90.0.4430.85

Fresh install or upgraded from other version?
fresh install

Steps to reproduce :

  1. Launch APM server, elastic search, and Kibana containers
  2. Install Node APM in the server
  3. Run express/fastify (whatever)

Errors in browser console (if relevant):
{"log.level":"error","@timestamp":"2021-05-12T10:26:51.748Z","log":{"logger":"elastic-apm-node"},"ecs":{"version":"1.6.0"},"message":"APM Server transport error (HPE_INVALID_CONSTANT): Parse Error: Expected HTTP/"}

Provide logs and/or server output (if relevant):

According to elastic document, I found this error every 5 seconds(?), not exactly. how can i fix that?
please tell me about solution. (use express or fastify, it doesn't matter)

thank you.

Nice to meet you @Max_Lee and thanks for reporting this.

That's an interesting error that we haven't seen before. The HPE_INVALID_CONSTANT error comes from Node.js, and usually indicates Node.js couldn't parse an HTTP response when making a request to a server. It looks like that response came from the request Node.js makes to APM Server when sending agent data.

Two questions come to mind that might help us debug this,

  1. In your agent's configuration, what value is serverUrl set to?
  2. Is APM Server receiving telemetry data and sending it to your elasticsearch instance? (in other words, are you seeing data in the APM section of Kibana?)

this problem causes my fault (remove some files in node_modules), delete and re-npm install then resolved this problem.

thank you.

1 Like

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