Comments (3)
hi @RKrahl
can you try
npx ts-node ./exampleQuery.ts
from search-api.
You mean in the second terminal in the place of the curl call?
On my desktop, it does not work, because the npm start
binds at the external IP address of my box, while npx ts-node ./exampleQuery.ts
tries to connect to localhost and gets a connection refused. I have no idea how to control this.
In the meanwhile, I built a dockerized version (rkrahl/nodejs:12.14.1
on Docker Hub). There, the result is curious:
If I run npx ts-node ./exampleQuery.ts
once in the second terminal, I get
{
"where": {
"and": [
{
"variable": "temperature",
"operator": "gt",
"value": 0,
"unit": "degC"
},
{
"variable": "pressure",
"operator": "gt",
"value": 7000000,
"unit": "kg/m*s2"
}
]
}
}
http://localhost:3000/datasets?filter=%7B%22where%22%3A%7B%22and%22%3A%5B%7B%22variable%22%3A%22temperature%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A0%2C%22unit%22%3A%22degC%22%7D%2C%7B%22variable%22%3A%22pressure%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A7000000%2C%22unit%22%3A%22kg%2Fm*s2%22%7D%5D%7D%7D
[]
as output and
Try http://[::1]:3000/ping
{ 'temperature.value': { gt: 0 } }
{ 'pressure.value': { gt: 7000000 } }
[
{ 'temperature.value': { gt: 0 } },
{ 'pressure.value': { gt: 7000000 } }
]
in the log of the npm start
process.
If I run the very same call a second time, I get:
{
"where": {
"and": [
{
"variable": "temperature",
"operator": "gt",
"value": 0,
"unit": "degC"
},
{
"variable": "pressure",
"operator": "gt",
"value": 7000000,
"unit": "kg/m*s2"
}
]
}
}
http://localhost:3000/datasets?filter=%7B%22where%22%3A%7B%22and%22%3A%5B%7B%22variable%22%3A%22temperature%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A0%2C%22unit%22%3A%22degC%22%7D%2C%7B%22variable%22%3A%22pressure%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A7000000%2C%22unit%22%3A%22kg%2Fm*s2%22%7D%5D%7D%7D
StatusCodeError: 500 - "{\"error\":{\"statusCode\":500,\"message\":\"Internal Server Error\"}}"
at new StatusCodeError (/usr/lib/nodejs/search-api/node_modules/request-promise-core/lib/errors.js:32:15)
at Request.plumbing.callback (/usr/lib/nodejs/search-api/node_modules/request-promise-core/lib/plumbing.js:104:33)
at Request.RP$callback [as _callback] (/usr/lib/nodejs/search-api/node_modules/request-promise-core/lib/plumbing.js:46:31)
at Request.self.callback (/usr/lib/nodejs/search-api/node_modules/request/request.js:185:22)
at Request.emit (events.js:223:5)
at Request.EventEmitter.emit (domain.js:475:20)
at Request.<anonymous> (/usr/lib/nodejs/search-api/node_modules/request/request.js:1161:10)
at Request.emit (events.js:223:5)
at Request.EventEmitter.emit (domain.js:475:20)
at IncomingMessage.<anonymous> (/usr/lib/nodejs/search-api/node_modules/request/request.js:1083:12) {
name: 'StatusCodeError',
statusCode: 500,
message: '500 - "{\\"error\\":{\\"statusCode\\":500,\\"message\\":\\"Internal Server Error\\"}}"',
error: '{"error":{"statusCode":500,"message":"Internal Server Error"}}',
options: {
uri: 'http://localhost:3000/datasets?filter=%7B%22where%22%3A%7B%22and%22%3A%5B%7B%22variable%22%3A%22temperature%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A0%2C%22unit%22%3A%22degC%22%7D%2C%7B%22variable%22%3A%22pressure%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A7000000%2C%22unit%22%3A%22kg%2Fm*s2%22%7D%5D%7D%7D',
method: 'GET',
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false
},
response: IncomingMessage {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
paused: false,
emitClose: true,
autoDestroy: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: true,
decoder: null,
encoding: null
},
readable: false,
_events: [Object: null prototype] {
end: [Array],
close: [Array],
data: [Function],
error: [Function]
},
_eventsCount: 4,
_maxListeners: undefined,
socket: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: 'localhost',
_readableState: [ReadableState],
readable: true,
_events: [Object: null prototype],
_eventsCount: 6,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [ClientRequest],
[Symbol(asyncId)]: 13,
[Symbol(kHandle)]: [TCP],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
connection: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: 'localhost',
_readableState: [ReadableState],
readable: true,
_events: [Object: null prototype],
_eventsCount: 6,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [ClientRequest],
[Symbol(asyncId)]: 13,
[Symbol(kHandle)]: [TCP],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: {
'x-powered-by': 'Express',
'access-control-allow-origin': '*',
'access-control-allow-credentials': 'true',
'x-content-type-options': 'nosniff',
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 23 Jan 2020 14:29:58 GMT',
connection: 'close',
'content-length': '62'
},
rawHeaders: [
'X-Powered-By',
'Express',
'Access-Control-Allow-Origin',
'*',
'Access-Control-Allow-Credentials',
'true',
'X-Content-Type-Options',
'nosniff',
'Content-Type',
'application/json; charset=utf-8',
'Date',
'Thu, 23 Jan 2020 14:29:58 GMT',
'Connection',
'close',
'Content-Length',
'62'
],
trailers: {},
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 500,
statusMessage: 'Internal Server Error',
client: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: 'localhost',
_readableState: [ReadableState],
readable: true,
_events: [Object: null prototype],
_eventsCount: 6,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
parser: null,
_httpMessage: [ClientRequest],
[Symbol(asyncId)]: 13,
[Symbol(kHandle)]: [TCP],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
_consuming: false,
_dumped: false,
req: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Socket],
connection: [Socket],
_header: 'GET /datasets?filter=%7B%22where%22%3A%7B%22and%22%3A%5B%7B%22variable%22%3A%22temperature%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A0%2C%22unit%22%3A%22degC%22%7D%2C%7B%22variable%22%3A%22pressure%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A7000000%2C%22unit%22%3A%22kg%2Fm*s2%22%7D%5D%7D%7D HTTP/1.1\r\n' +
'host: localhost:3000\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'GET',
path: '/datasets?filter=%7B%22where%22%3A%7B%22and%22%3A%5B%7B%22variable%22%3A%22temperature%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A0%2C%22unit%22%3A%22degC%22%7D%2C%7B%22variable%22%3A%22pressure%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A7000000%2C%22unit%22%3A%22kg%2Fm*s2%22%7D%5D%7D%7D',
_ended: true,
res: [Circular],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
[Symbol(kNeedDrain)]: false,
[Symbol(isCorked)]: false,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
request: Request {
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
uri: [Url],
method: 'GET',
readable: true,
writable: true,
explicitMethod: true,
_qs: [Querystring],
_auth: [Auth],
_oauth: [OAuth],
_multipart: [Multipart],
_redirect: [Redirect],
_tunnel: [Tunnel],
_rp_resolve: [Function],
_rp_reject: [Function],
_rp_promise: [Promise],
_rp_callbackOrig: undefined,
callback: [Function],
_rp_options: [Object],
headers: {},
setHeader: [Function],
hasHeader: [Function],
getHeader: [Function],
removeHeader: [Function],
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function: RP$callback],
proxy: null,
tunnel: false,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: '3000',
host: 'localhost',
path: '/datasets?filter=%7B%22where%22%3A%7B%22and%22%3A%5B%7B%22variable%22%3A%22temperature%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A0%2C%22unit%22%3A%22degC%22%7D%2C%7B%22variable%22%3A%22pressure%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A7000000%2C%22unit%22%3A%22kg%2Fm*s2%22%7D%5D%7D%7D',
httpModule: [Object],
agentClass: [Function],
agent: [Agent],
_started: true,
href: 'http://localhost:3000/datasets?filter=%7B%22where%22%3A%7B%22and%22%3A%5B%7B%22variable%22%3A%22temperature%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A0%2C%22unit%22%3A%22degC%22%7D%2C%7B%22variable%22%3A%22pressure%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A7000000%2C%22unit%22%3A%22kg%2Fm*s2%22%7D%5D%7D%7D',
req: [ClientRequest],
ntick: true,
response: [Circular],
originalHost: 'localhost:3000',
originalHostHeaderName: 'host',
responseContent: [Circular],
_destdata: true,
_ended: true,
_callbackCalled: true
},
toJSON: [Function: responseToJSON],
caseless: Caseless { dict: [Object] },
body: '{"error":{"statusCode":500,"message":"Internal Server Error"}}'
}
}
as output and
{ 'temperature.value': { gt: 0 } }
{ 'pressure.value': { gt: 7000000 } }
[
{ 'temperature.value': { gt: 0 } },
{ 'pressure.value': { gt: 7000000 } }
]
Unhandled error in GET /datasets?filter=%7B%22where%22%3A%7B%22and%22%3A%5B%7B%22variable%22%3A%22temperature%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A0%2C%22unit%22%3A%22degC%22%7D%2C%7B%22variable%22%3A%22pressure%22%2C%22operator%22%3A%22gt%22%2C%22value%22%3A7000000%2C%22unit%22%3A%22kg%2Fm*s2%22%7D%5D%7D%7D: 500 Error: Unit not recognized
at new QtyError (/usr/lib/nodejs/search-api/node_modules/js-quantities/build/quantities.js:180:17)
at parseUnits (/usr/lib/nodejs/search-api/node_modules/js-quantities/build/quantities.js:794:13)
at Qty.parse (/usr/lib/nodejs/search-api/node_modules/js-quantities/build/quantities.js:748:24)
at new Qty (/usr/lib/nodejs/search-api/node_modules/js-quantities/build/quantities.js:872:13)
at convertUnits (/usr/lib/nodejs/search-api/src/repositories/dataset.repository.ts:37:15)
at processQuery (/usr/lib/nodejs/search-api/src/repositories/dataset.repository.ts:67:11)
at /usr/lib/nodejs/search-api/src/repositories/dataset.repository.ts:26:31
at notifySingleObserver (/usr/lib/nodejs/search-api/node_modules/loopback-datasource-juggler/lib/observer.js:162:24)
at /usr/lib/nodejs/search-api/node_modules/async/dist/async.js:3110:16
at replenish (/usr/lib/nodejs/search-api/node_modules/async/dist/async.js:1011:17)
at iterateeCallback (/usr/lib/nodejs/search-api/node_modules/async/dist/async.js:995:17)
at /usr/lib/nodejs/search-api/node_modules/async/dist/async.js:969:16
at /usr/lib/nodejs/search-api/node_modules/loopback-datasource-juggler/lib/observer.js:165:26
at processTicksAndRejections (internal/process/task_queues.js:94:5)
in the log of the npm start
process.
from search-api.
This should be working now
from search-api.
Related Issues (20)
- Add field translation to rest api backend connection HOT 1
- add documentation HOT 2
- Questions on the data model HOT 5
- Questions on the API calls HOT 4
- Document the search API HOT 1
- Need a query syntax capable of searching objects based on properties of related objects HOT 5
- Need to define what is included in the results of the API calls HOT 3
- Unit support in queries HOT 2
- Divide list of experimental technique by facility type
- Person role HOT 1
- units and conversions
- Including both person and affiliation in member scope throws 500 HOT 4
- Return entries although their related objects are missing HOT 1
- Multiple scopes result in 500 (search by parameter & include related data at the same time) HOT 2
- Count of items returned for a specific query HOT 3
- AND operator seems broken for parameters
- ilike/nilike on ESS's federated endpoint
- Cannot use 'in' operator to search for 'limit' HOT 5
- add http interceptor HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from search-api.