elastic / elastic/apm-agent-nodejs
decode error when sending response.status_code as string
- Dominant language
- JavaScript
- Stars
- 594
- Forks
- 244
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 16
Description
**Describe the bug**
According to the specification, status_code must be a number.
As part of the ops KPI review we've been investigating the following errors in ecs logs:
```
decode error: data read error: v2.transactionRoot.Transaction: v2.transaction.Context: v2.context.Response: v2.contextResponse.StatusCode: readUint64: unexpected character: �, error found in #10 byte of ...|us_code":"200"}},"sy|..., bigger context ...|.1.1"},"custom":{},"response":{"status_code":"200"}},"sync":false,"span_count":{"started":2},"ou|...,
```
`{"status_code":"200"}` is not valid format and the apm-server will fail to ingest those transactions.
**To Reproduce**
I don't have steps to reproduce, this is part of the ops KPI review and was observed in the ecs logs.
**Expected behavior**
`status_code` is sent as a number and apm-server accepts the request.
**Environment (please complete the following information)**
Most of the errors are coming from the following user agent: `elasticapm-node/3.15.0 elastic-apm-http-client/9.9.0 node/14.16.1`
This happens on multiple apm-server versions. Both 7.x and 8.x, including the latest 8.9.0.
**How are you starting the agent? (please tick one of the boxes)**
- [ ] Calling `agent.start()` directly (e.g. `require('elastic-apm-node').start(...)`)
- [ ] Requiring `elastic-apm-node/start` from within the source code
- [ ] Starting node with `-r elastic-apm-node/start`
**Additional context**
None
Contributor guide
Assessment
This issue has not been assessed yet.