Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: this.logFn is not a function #275

Open
andresespinosapc opened this issue Apr 29, 2021 · 5 comments
Open

TypeError: this.logFn is not a function #275

andresespinosapc opened this issue Apr 29, 2021 · 5 comments

Comments

@andresespinosapc
Copy link

I'm getting the error TypeError: this.logFn is not a function. I think it's because of this line:

this.logFn("failed to clear async namespace", LogLevel.Debug);

@fborie
Copy link

fborie commented Sep 17, 2021

were you able to solve it @andresespinosapc ? 👀 I am facing the same issue in an express setup with typescript. Each time I hit an endpoint I get that noisy error

@muayKenny
Copy link

me too! hit that same error.

import API from "@scout_apm/scout-apm"; const scout = API;

scout.install({ allowShutdown: true, // allow shutting down spawned scout-agent processes from this program monitor: true, // enable monitoring name: process.env.SCOUT_NAME, key: process.env.SCOUT_KEY, });

server.use(scout.expressMiddleware());

my installation

@yaronlevi
Copy link

Happens here also? Any ideas?

@Tsirovasilis-I
Copy link

Hello, do we have any news on this?

@fidel-ruiz
Copy link

The way to fix this is by implementing that function when initializing scout as explained in https://github.com/scoutapp/scout_apm_node/blob/master/docs/integrations/express.md

Example code:

await scout.install({
  monitor: true,
  name: "<your name>",
  key: "<key>",
}, {
  logFn: (message, level) => {
    console.log(message, level)
  }
}).then(() => {
  console.log("scout initialized");
})

With the code above it produces the output for scout logs

023-05-30T22:53:44.640727+00:00 app[web.1]: [scout] Creating request for instrumentation warn
2023-05-30T22:53:44.654445+00:00 app[web.1]: failed to clear async namespace debug
2023-05-30T22:53:44.654514+00:00 app[web.1]: failed to clear async namespace debug
2023-05-30T22:54:04.648705+00:00 app[web.1]: [scout] Creating request for instrumentation warn
2023-05-30T22:54:04.662112+00:00 app[web.1]: failed to clear async namespace debug
2023-05-30T22:54:04.662134+00:00 app[web.1]: failed to clear async namespace debug
2023-05-30T22:54:24.658401+00:00 app[web.1]: [scout] Creating request for instrumentation warn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants