Hi,
I have installed @feathersjs/cli 3.7.5 and generate an app whith feathers generate app.
When I create a custom service "test", I have an error when access to http://localhost:3030/test.
error: TypeError: Cannot read property 'length' of undefined
at validateArguments (/home/sol404/Documents/siteLabs/HTL/save_test/node_modules/@feathersjs/commons/lib/arguments.js:7:24)
at Object.validateHook (/home/sol404/Documents/siteLabs/HTL/save_test/node_modules/@feathersjs/feathers/lib/hooks.js:48:9)
at promise.then.hookObject (/home/sol404/Documents/siteLabs/HTL/save_test/node_modules/@feathersjs/commons/lib/hooks.js:141:73)
I am not able to reproduce this issue with the standard steps (generate new application, generate test custom service). Can you provide additional information on your operating system, NodeJS version and how your service file looks like?
Thanks for your answer.
My system is an Ubuntu 16.04.5 LTS 64-bit.
Node -v ==> v10.7.0
npm -v ==> v6.1.0
For the service test, I have just generate the custom service, without changing anything.
In @feathersjs/commons/lib/arguments.js, I have add a console.log with params of the validateArgements Function like this:
exports.validateArguments = function validateArguments (argsOrders, method, args) {
console.log("argument.js", argsOrders, method, args)
and here the result: argument.js find [ { query: {}, route: {}, provider: 'rest' } ] undefined
Very strange ...
I'm getting the same error on a new app. Also found the same validateArguments() with the new argsOrders parameter (commit: https://github.com/feathersjs/commons/pull/72/commits/25239b14d85dbc1ffc9633a3364583b454b56ffa on 26 May).
@feathersjs/feathers/lib/hooks.js:48:9 calls this function with only two parameters (last commit 4 May):
const validateHook = context => {
validateArguments(method, args);
return context;
};
Is it possible that validateHook() wasn't updated when validateArguments() received a new parameter?
I was able to reproduce this issue with the standard steps (generate new application, generate test in-memory service).
The error doesn't occur after npm start. It occurs on a service call (e.g. http://localhost:3030/test).
But it's strange because two days ago, no problem, but today ...
With the client, I have this error when called an service.
Cannot read property 'eventMappings' of undefined
at Object.<anonymous> (events.js:9)
at promise.then.hookObject (hooks.js:141)
Maybe can help
I solved it by adding:
"@feathersjs/commons": ">=1.4.1 <=1.4.1",
in package.json.
It worked even 12 hours ago ;-)
The changes to validateArguments() were merged 11 hours ago: https://github.com/feathersjs/commons/blob/master/CHANGELOG.md#v142-2018-07-25
It's resolved, thanks borujures, great work !
Got it. It was an accidental breaking change which should be fixed in @feathersjs/[email protected] when reinstalling everything. Make sure that npm ls @feathersjs/commons does _not_ show version 1.4.2 (it has been unpublished).
I thought I was going crazy for a minute there!
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs.
Most helpful comment
I solved it by adding:
"@feathersjs/commons": ">=1.4.1 <=1.4.1",in
package.json.