When running a test that captures data from the response and the response does not match the expected shape it crashes
AssertionError [ERR_ASSERTION]: obj needs to be an object
at JSONPath.query (/home/kenneth/load-testing/node_modules/jsonpath/lib/index.js:91:10)
at extractJSONPath (/home/kenneth/load-testing/node_modules/artillery/core/lib/engine_util.js:481:26)
at /home/kenneth/load-testing/node_modules/artillery/core/lib/engine_util.js:355:30
at parseJSON (/home/kenneth/load-testing/node_modules/artillery/core/lib/engine_util.js:468:10)
at /home/kenneth/load-testing/node_modules/artillery/core/lib/engine_util.js:347:7
at /home/kenneth/load-testing/node_modules/async/lib/async.js:181:20
at iterate (/home/kenneth/load-testing/node_modules/async/lib/async.js:262:13)
at Object.async.forEachOfSeries.async.eachOfSeries (/home/kenneth/load-testing/node_modules/async/lib/async.js:281:9)
at Object.async.forEachSeries.async.eachSeries (/home/kenneth/load-testing/node_modules/async/lib/async.js:214:22)
at Object.captureOrMatch (/home/kenneth/load-testing/node_modules/artillery/core/lib/engine_util.js:333:9)
using 1.6.0-24
Thanks for the bug report @kennethlynne! 1.6.0-24 uses a new JSON path implementation, and we're discovering differences in behaviour between that and the library used previously.
This patch solved it it seems
patch-package
--- a/node_modules/artillery/core/lib/engine_util.js
+++ b/node_modules/artillery/core/lib/engine_util.js
@@ -478,7 +478,12 @@ function extractJSONPath(doc, expr) {
return '';
}
- let results = jsonpath.query(doc, expr);
+ let results;
+ try {
+ results = jsonpath.query(doc, expr);
+ } catch (err) {
+ return '';
+ }
if (!results) {
return '';
I also have this bug, do we have an idea when is schedule the next release ?
Thank you !
FEI We used this https://www.npmjs.com/package/patch-package + the aforementioned patch to fix it in our case since we were in a hurry
New release with a fix will be out in the next couple of days. Thanks @kennethlynne!
Most helpful comment
This patch solved it it seems