CallSite method getFileName expects CallSite as receiver

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/
    at gatherStackTrace (/usr/src/app/.yarn/cache/
    at Object.createAPMError (/usr/src/app/.yarn/cache/
- 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(...)

@Hardik_Kaushik Thanks for reporting this.

As best I can tell, this is what is happening:

  1. 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.
  2. 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:

  1. 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.)
  2. 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.

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