Hello.
I'm trying to use APM in a Node+Express+Typescript backend. I followed this:
https://www.elastic.co/guide/en/apm/agent/nodejs/current/es-modules.html
So now I have this on my tsconfig.json
:
"esModuleInterop": true,
And in my app.ts
I try to start the agent like this:
import apm from 'elastic-apm-node/start';
const apmClient = apm.start({
serviceName:
process.env.ELASTIC_APM_SERVICE_NAME || 'elastic-apm-demo-middleware',
serverUrl: process.env.ELASTIC_APM_SERVER_URL || 'http://apm-server:8200',
secretToken: process.env.ELASTIC_APM_SECRET_TOKEN || '',
logUncaughtExceptions: true
});
Problems:
- It generates an error, which is sent to the APM server:
Do not call .start() more than once
- It points to the wrong line... I guess this is due the transpilation process, so I'll have to find how to publish the source maps...
What am I not getting right in the agent's start process?
Thank you