elastic / elastic/apm-agent-nodejs

currentTransaction.startSpan return null when I use express.

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

Description

**Describe the bug**

```javascript
const currentTransaction = apm.currentTransaction;
const span = currentTransaction.startSpan(name);
```
I use the code above in express context, but the `span` is null.

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

- OS: [e.g. Linux] win10
- Node.js version: 12.18.1
- APM Server version:3.6.1
- Agent version: 6.3.2

**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`

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.