kuzzleio / kuzzle

Open-source Back-end, self-hostable & ready to use - Real-time, storage, advanced search - Web, Apps, Mobile, IoT -
https://kuzzle.io
Apache License 2.0
1.44k stars 124 forks source link

"Invalid from: expected a number" #1022

Closed Tyki closed 6 years ago

Tyki commented 6 years ago

I have a lot of times this error :

{ ExternalServiceError: Invalid from: expected a number.
at ExternalServiceError (/opt/kuzzle/node_modules/kuzzle-common-objects/lib/errors/externalServiceError.js:5:5)
at ESWrapper.formatESError (/opt/kuzzle/lib/util/esWrapper.js:162:23)
at client.search.then.catch.error (/opt/kuzzle/lib/services/elasticsearch.js:183:54)
at tryCatcher (/opt/kuzzle/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/opt/kuzzle/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/opt/kuzzle/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/opt/kuzzle/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/opt/kuzzle/node_modules/bluebird/js/release/promise.js:689:18)
at Async._drainQueue (/opt/kuzzle/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/opt/kuzzle/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/opt/kuzzle/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:637:20)
at tryOnImmediate (timers.js:610:5)
at processImmediate [as _immediateCallback] (timers.js:582:5)
status: 500,
internalError: 
TypeError: Invalid from: expected a number.
at Object.number (/opt/kuzzle/node_modules/elasticsearch/src/lib/client_action.js:157:13)
at exec (/opt/kuzzle/node_modules/elasticsearch/src/lib/client_action.js:337:65)
at Object.action (/opt/kuzzle/node_modules/elasticsearch/src/lib/client_action.js:61:16)
at ElasticSearch.search (/opt/kuzzle/lib/services/elasticsearch.js:167:24)
at DocumentController.search (/opt/kuzzle/lib/api/controllers/documentController.js:75:24)
at callController (/opt/kuzzle/lib/api/controllers/funnelController.js:647:74)
at Bluebird.resolve.then (/opt/kuzzle/lib/api/controllers/funnelController.js:435:19)
at tryCatcher (/opt/kuzzle/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/opt/kuzzle/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/opt/kuzzle/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromiseCtx (/opt/kuzzle/node_modules/bluebird/js/release/promise.js:606:10)
at Async._drainQueue (/opt/kuzzle/node_modules/bluebird/js/release/async.js:138:12)
at Async._drainQueues (/opt/kuzzle/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/opt/kuzzle/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:637:20)
at tryOnImmediate (timers.js:610:5)
at processImmediate [as _immediateCallback] (timers.js:582:5),
service: 'elasticsearch' }

I have a custom plugin but no stacktrace about an eventual plugin issue

scottinet commented 6 years ago

It comes from a paginated search request using the document:search API. As the error states, the from parameter requires a number.

Considering the stacktrace, either it comes from a direct API call, or if it's called by a plugin, then it means that the promise returned by pluginContext.accessors.execute is not catched. In that case, Kuzzle tries its best to catch and log the error.

Either way, I do not think this is a Kuzzle issue.