elastic / elastic/apm-agent-nodejs

No errors are reported for GraphQL request

Open
#1,832 1 comment 0 reactions 0 assignees View on GitHub
agent-nodejs enhancement
Dominant language
JavaScript
Stars
594
Forks
244
Avg merge
1d 8h
Merged PRs (30d)
16

Description

**Describe the bug**

In case of GraphQL requests are finished with errors, I expect that such errors will be reported to Elastic APM. However, they are not.

**To Reproduce**

The usual configuration with `apollo-server-express`. As a reference, you can return null for a field that is marked required.
Your GraphQL server will answer with the following response:

```json
{
"errors": [
{
"message": "Cannot return null for non-nullable field *****.",
"locations": [
{
"line": 9,
"column": 7
}
],
"path": [
"****",
"****",
"****"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"stacktrace": [

]
}
}
}
],
"data": {
}
}
```

**Expected behavior**

The errors under the `errors` property must be reported to the Elastic APM server

**Environment (please complete the following information)**

- OS: Windows
- Node.js version: v12.18.2
- APM Server version: 7.9.2
- Agent version: 3.7.0

**How are you starting the agent? (please tick one of the boxes)**

- [ ] Calling `agent.start()` directly (e.g. `require('elastic-apm-node').start(...)`)
- [X] Requiring `elastic-apm-node/start` from within the source code
- [ ] Starting node with `-r elastic-apm-node/start`

P.S.: I'll try to prepare a small app to show that behavior.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.