jq-web module suddenly stops working
dars1608 opened this issue · comments
Hello!
I'm using the jq-web module to validate some jq expressions on my NodeJS application. Application was working as expected for a few days on K8s cluster and I validated ~1000 expressions. Then, out of nowhere, this happened.
There is an error in expression: ".IG_PKT_DROP__NO_FLOW > 0". Message: Error\n at Object.ensureErrnoError (/usr/src/app/node_modules/jq-web/jq.asm.bundle.min.js:1:1722236)\n at Object.staticInit (/usr/src/app/node_modules/jq-web/jq.asm.bundle.min.js:1:1722445)\n at /usr/src/app/node_modules/jq-web/jq.asm.bundle.min.js:1:1734039\n at Object. (/usr/src/app/node_modules/jq-web/jq.asm.bundle.min.js:1:1751789)\n at Module._compile (internal/modules/cjs/loader.js:1147:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)\n at Module.load (internal/modules/cjs/loader.js:996:32)\n at Function.Module._load (internal/modules/cjs/loader.js:896:14)\n at Module.require (internal/modules/cjs/loader.js:1036:19)\n at require (internal/modules/cjs/helpers.js:72:18)\n at Object. (/usr/src/app/jq/jq-validator.js:3:12)\n at Module._compile (internal/modules/cjs/loader.js:1147:30)\n at`` Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)\n at Module.load (internal/modules/cjs/loader.js:996:32)\n at Function.Module._load (internal/modules/cjs/loader.js:896:14)\n at Module.require (internal/modules/cjs/loader.js:1036:19)\n at require (internal/modules/cjs/helpers.js:72:18)\n at Object. (/usr/src/app/service/AggregatingAlertRuleService.js:10:21)\n at Module._compile (internal/modules/cjs/loader.js:1147:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)\n at Module.load (internal/modules/cjs/loader.js:996:32)\n at Function.Module._load (internal/modules/cjs/loader.js:896:14)
const validate = (expression, example, skipSemantic=false) => {
let result;
try {
result = jq.json(example, expression);
if (result === null) {
return new JqInvalidResult(expression, "Expression returned no result.")
}
} catch (e) {
return new JqSyntaxErrorResult(expression, e);
}
//other logic
}
Can you help me? I tried to go through the source code using the lines:offsets but it is all minified js code.
Sorry. I can't help you. I don't understand this at all. IG_PKT_DROP__NO_FLOW > 0
? I don't understand this.
But also I think it's more like a miracle that this works in Node.js even if only for the first 100 times, it was supposed to work in browsers only, because if you're running Node.js in a server you already have access to the original jq. My suggestion is that you use something like https://www.npmjs.com/package/node-jq.