APM agent an Typescript


I'm trying to use APM in a Node+Express+Typescript backend. I followed this:


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({
        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


  1. It generates an error, which is sent to the APM server: Do not call .start() more than once
  2. 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

1 Like

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