You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During the process of moving the Elastic APM agent over to using pino and this @elastic/ecs-pino-format package, we hit this crash:
/app/node_modules/@elastic/ecs-pino-format/index.js:55
const apm = elasticApm && elasticApm.isStarted() ? elasticApm : null
^
TypeError: elasticApm.isStarted is not a function
at createEcsPinoOptions (/app/node_modules/@elastic/ecs-pino-format/index.js:55:40)
at Object.createLogger (/app/node_modules/elastic-apm-node/lib/logging.js:143:8)
at new Config (/app/node_modules/elastic-apm-node/lib/config.js:243:27)
at config (/app/node_modules/elastic-apm-node/lib/config.js:213:10)
at Agent._config (/app/node_modules/elastic-apm-node/lib/agent.js:133:16)
at new Agent (/app/node_modules/elastic-apm-node/lib/agent.js:39:8)
at Object.<anonymous> (/app/node_modules/elastic-apm-node/index.js:5:18)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
The reason is that the guarded import of the apm agent:
This should be a situation that can only be hit if the elastic APM agent itself (or one the deps that it loads) uses ecs-pino-format. I'd like to fix this with two changes:
improve that guard to handle the loaded: false case
During the process of moving the Elastic APM agent over to using pino and this
@elastic/ecs-pino-format
package, we hit this crash:The reason is that the guarded import of the apm agent:
results in
elasticApm === {}
, because this check is done before "elastic-apm-node" is loaded:require.cache
includes:Note
loaded: false
and henceexports: {}
.This should be a situation that can only be hit if the elastic APM agent itself (or one the deps that it loads) uses ecs-pino-format. I'd like to fix this with two changes:
loaded: false
caseThe text was updated successfully, but these errors were encountered: