uncaughtException: CallSite method getFileName expects CallSite as receiver
TypeError: CallSite method getFileName expects CallSite as receiver
at CallSite.getFileName (<anonymous>)
at frameFromCallSite (/usr/src/app/.yarn/cache/elastic-apm-node-npm-3.36.0-8762a46181-1e86195425.zip/node_modules/elastic-apm-node/lib/stacktraces.js:258:29)
at gatherStackTrace (/usr/src/app/.yarn/cache/elastic-apm-node-npm-3.36.0-8762a46181-1e86195425.zip/node_modules/elastic-apm-node/lib/stacktraces.js:429:7)
at Object.createAPMError (/usr/src/app/.yarn/cache/elastic-apm-node-npm-3.36.0-8762a46181-1e86195425.zip/node_modules/elastic-apm-node/lib/errors.js:196:5)
- This error is thrown after this got logged.
error thrown is getaddrinfo ENOTFOUND some.addresss
Any work around to fix this? don't want this error to go unhandled next time.
Yarn 3.5.1
Node 14
elastic-apm-node 3.34.0
using require('elastic-apm-node').start(...)
Something is calling the APM agent's agent.captureError(...) API -- that will be either your code directly calling that API, or the default handler that the APM agent sets up for an uncaughtException thrown by some JavaScript code.
The APM agent's internal code that uses the CallSite objects returned by v8's stack trace API (Stack trace API · V8) is failing.
The only ideas I have on how that error -- TypeError: CallSite method getFileName expects CallSite as receiver -- could happen:
There is some other module or code in your application that is setting Error.prepareStackTrace to customize stack traces and this is competing with the Error.prepareStackTrace that the APM agent is using to collect stack trace information. (The APM agent uses the GitHub - watson/error-callsites: Extract callsite objects from Error objects module to collect stack trace information.)
Possibly something is resulting in there being multiple CallSite classes in play. This could be something different about how yarn works compared to an npm install that I am more familiar with. It could possibly be related to bundler usage -- but I don't think so.
Can you provide some more details on your application?
Can you show your full "dependencies" and "devDependencies" from your "package.json"?
Do you know if anything is setting Error.prepareStackTrace in your application or in its dependencies?
Are you using a bundler? (Like webpack, or esbuild, etc.)
Your comment says you are using elastic-apm-node 3.34.0, but the stack trace suggests your are using version 3.36.0. It might be worth updating to the latest to see if that fixes anything, but I'm not hopeful.
Ideally, if you are able, a small reproduction case would help me debug this.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.