question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clustering - Cannot read property 'responses' of undefined

See original GitHub issue

https://github.com/siimon/prom-client/blob/master/lib/cluster.js#L159

I am attempting run prometheus in an application that collects metrics for calls within koa middleware

But I am finding that this line

const request = requests.get(message.requestId);

returns undefined, causing line 159 to throw the error Cannot read property 'responses' of undefined

Its also worth mentioning I’m running metrics through a node proxy server and collecting metrics in the middleware itself - if i guard on the presence of request, it appears to work as expected

if (request) {
  message.metrics.forEach(registry => request.responses.push(registry));
  request.pending--;
  // etc
}

The middleware is mounted at /api where i’m using promClient.Histogram to time calls

I’m afraid I don’t understand the code well enough to understand why the request is undefined. Is anyone available to walk me through this?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
edvardchencommented, Nov 21, 2019

I had encountered same issue. It turned out that my worker script imported two copy of module prom-client

@montykamath

0reactions
zbjornsoncommented, Nov 8, 2019

There’s no state like that, no. If you have a full repro that you can post, I’ll try to take a look.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'find' of undefined MongoDB ...
Im trying to get data from MongoDB cluster first time.but showing error like that. I cant understand the bug. mongoose .connect(mongoDB ...
Read more >
error in setup: "typeerror: cannot read properties of undefined ...
ERROR TypeError : Cannot read properties of undefined (reading 'length') tells you that, at one point in time, the value of expertList is...
Read more >
Marvel refusing to load : "Cannot read property 'cluster_name ...
Hi there, I just installed Marvel for the first time on a production cluster running Kibana 4.4.2, ES 2.2.1.
Read more >
Cluster | Node.js v19.3.0 Documentation
This property is true if the worker exited due to .disconnect() . If the worker exited any other way, it is false ....
Read more >
[NODE-3192] Cannot read property 'clusterTime' of undefined
When making a rolling restart of my Atlas cluster, this error is sometimes thrown when the client looses or re-establishes the connection, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found