Registering static methods are remote methods in Loopback 2.0

Loopback 2.0 and getting:

/node_modules/loopback-connector-mongodb/node_modules/mongodb/lib/mongodb/connection/base.js:246
throw message;
^
TypeError: Cannot call method ‘apply’ of undefined
at SharedMethod.invoke /node_modules/loopback/node_modules/strong-remoting/lib/shared-method.js:213:17)

Reason is more than likely that you have defined a staticĀ methodĀ on your model that does not match the string used to register the static method as a remote method as outline here.

Advertisements