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.

Cannot read property 'method' of null since 7.14.0

See original GitHub issue

🐛 Bug Report

We suddenly get a lot of errors from elastic module.

errorHandler[500]: {“domainThrown”:true,“status”:500} TypeError: Cannot read property ‘method’ of null 2021-08-11 13:08:32at EventEmitter.<anonymous> (/app/node_modules/elastic-apm-node/lib/instrumentation/modules/@elastic/elasticsearch.js:47:52)

500 Error: error executing elastic query: TypeError: Cannot read property 'method' of null
2021-08-11 13:08:36at ElasticService.search (/app/node_modules/@hokify/elastic-service/src/ElasticService.ts:293:10)
2021-08-11 13:08:36at ElasticOfferQuery.execQuery (/app/node_modules/@hokify/search/src/elastic/query/ElasticGenericQuery.ts:318:44)
2021-08-11 13:08:36at processTicksAndRejections (internal/process/task_queues.js:95:5)
2021-08-11 13:08:36at ElasticOfferQuery.exec (/app/node_modules/@hokify/search/src/elastic/ElasticOfferQuery.ts:237:18)
2021-08-11 13:08:36at OfferSearchService.executeCachedQuery (/app/node_modules/@hokify/search/src/OfferSearchService.ts:707:18)
2021-08-11 13:08:36at runMethod (/app/node_modules/@hokify/node-ts-cache/src/decorator/cache.decorator.ts:37:21)
2021-08-11 13:08:36at /app/node_modules/@hokify/node-ts-cache/src/decorator/cache.decorator.ts:65:28
2021-08-11 13:08:36at OfferSearchService.doSearch (/app/node_modules/@hokify/search/src/OfferSearchService.ts:539:23)
2021-08-11 13:08:36at JobSeekerSearchOfferService.doSearch (/app/node_modules/@hokify/user-service/src/JobSeekerSearchOfferService.ts:662:25)
2021-08-11 13:08:36at executeSearch (/app/node_modules/@hokify/user-service/src/JobSeekerSearchOfferService.ts:145:42)
2021-08-11 13:08:36at JobSeekerSearchOfferService.searchOffers (/app/node_modules/@hokify/user-service/src/JobSeekerSearchOfferService.ts:180:72)
2021-08-11 13:08:36at JobSeekerSearchController.getSuggestions (/app/src/controller/jobseeker/SearchController.ts:353:7)
2021-08-11 13:08:36err undefined TypeError: Cannot read property 'method' of null {}
2021-08-11 13:08:32errorHandler[500]: {"domainThrown":true,"status":500} TypeError: Cannot read property 'method' of null
2021-08-11 13:08:32at EventEmitter.<anonymous> (/app/node_modules/elastic-apm-node/lib/instrumentation/modules/@elastic/elasticsearch.js:47:52)
2021-08-11 13:08:32at EventEmitter.emit (events.js:400:28)
2021-08-11 13:08:32at EventEmitter.emit (domain.js:532:15)
2021-08-11 13:08:32at EventEmitter.<anonymous> (/app/node_modules/@elastic/elasticsearch/lib/Transport.js:464:18)
2021-08-11 13:08:32at Object.onceWrapper (events.js:520:26)
2021-08-11 13:08:32at EventEmitter.emit (events.js:400:28)
2021-08-11 13:08:32at EventEmitter.emit (domain.js:470:12)
2021-08-11 13:08:32at /app/node_modules/@elastic/elasticsearch/lib/Transport.js:590:40
2021-08-11 13:08:32at onBody (/app/node_modules/@elastic/elasticsearch/lib/Transport.js:358:9)
2021-08-11 13:08:32at IncomingMessage.onEnd (/app/node_modules/@elastic/elasticsearch/lib/Transport.js:275:11)
2021-08-11 13:08:32at IncomingMessage.emit (events.js:412:35)
2021-08-11 13:08:32at IncomingMessage.emit (domain.js:532:15)
2021-08-11 13:08:32at endReadableNT (internal/streams/readable.js:1317:12)
2021-08-11 13:08:32at processTicksAndRejections (internal/process/task_queues.js:82:21)
2021-08-11 13:08:32error TypeError: Cannot read property 'method' of null
2021-08-11 13:08:32at EventEmitter.<anonymous> (/app/node_modules/elastic-apm-node/lib/instrumentation/modules/@elastic/elasticsearch.js:47:52)
2021-08-11 13:08:32at EventEmitter.emit (events.js:400:28)
2021-08-11 13:08:32at EventEmitter.emit (domain.js:532:15)
2021-08-11 13:08:32at EventEmitter.<anonymous> (/app/node_modules/@elastic/elasticsearch/lib/Transport.js:464:18)
2021-08-11 13:08:32at Object.onceWrapper (events.js:520:26)
2021-08-11 13:08:32at EventEmitter.emit (events.js:400:28)
2021-08-11 13:08:32at EventEmitter.emit (domain.js:470:12)
2021-08-11 13:08:32at /app/node_modules/@elastic/elasticsearch/lib/Transport.js:590:40
2021-08-11 13:08:32at onBody (/app/node_modules/@elastic/elasticsearch/lib/Transport.js:358:9)
2021-08-11 13:08:32at IncomingMessage.onEnd (/app/node_modules/@elastic/elasticsearch/lib/Transport.js:275:11)
2021-08-11 13:08:32at IncomingMessage.emit (events.js:412:35)
2021-08-11 13:08:32at IncomingMessage.emit (domain.js:532:15)
2021-08-11 13:08:32at endReadableNT (internal/streams/readable.js:1317:12)
2021-08-11 13:08:32at processTicksAndRejections (internal/process/task_queues.js:82:21) {
2021-08-11 13:08:32domainThrown: true,
2021-08-11 13:08:32status: 500
2021-08-11 13:08:32}

which basically kills our servers…

Your Environment

  • node version: 14
  • @elastic/elasticsearch version: >=7.14.0
  • os: Linux
  • Docker environment

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
trentmcommented, Aug 11, 2021

Ultimately the thing crashing here is the APM agent (elastic-apm-node). The Client “request” event being used by the APM agent has .meta.request.params set to null despite https://github.com/elastic/elasticsearch-js/blob/master/lib/Transport.d.ts#L75

https://github.com/elastic/apm-agent-nodejs/pull/2188 changes the APM agent to be more defensive here. Once we have a release of that, that will fix or workaround the crash here. I’ll leave it up to @delvedor on whether to pursue the .meta.request.params being unset thing.

1reaction
trentmcommented, Aug 12, 2021

@simllll elastic-apm-node@3.20.0 is published now. If you are able to upgrade to that, the crash should go away. Thanks for the bug report.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Cannot read property 'value' of null" while linting · Issue #13394
It does not recognize my local version but in my package.json I have v7.1.0. I have the same error with nodejs v12.17.0.
Read more >
Uncaught TypeError: Cannot read property of null - iDiallo
This error occurs when you read a property or call a method on a null object . That's because the DOM API returns...
Read more >
TypeError: Cannot read property 'methods' of null
First : your initial state of this.state.contract is null, so first check if it's not null
Read more >
TypeError: Cannot read property 'has' of undefined - Help
I am executing a collection using Runner on Postman version 7.14.0. As part of the Tests Script, I am validating the response header ......
Read more >
cannot read properties of undefined (reading 'configurations')
error Cannot read properties of undefined (reading 'configurations'). TypeError: Cannot read properties of undefined (reading 'configurations') at Object.
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