Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cb is not a function error on non-static methods #12

Open
DerekTBrown opened this issue Jun 21, 2017 · 2 comments
Open

cb is not a function error on non-static methods #12

DerekTBrown opened this issue Jun 21, 2017 · 2 comments

Comments

@DerekTBrown
Copy link

I get a weird error when trying to use flexirest on non-static methods:

pocketflint     | /usr/src/pocketflint/node_modules/loopback-connector-flexirest/index.js:155
pocketflint     |                                 cb(err, body, response);
pocketflint     |                                 ^
pocketflint     | 
pocketflint     | TypeError: cb is not a function
pocketflint     |     at /usr/src/pocketflint/node_modules/loopback-connector-flexirest/index.js:155:33
pocketflint     |     at /usr/src/pocketflint/node_modules/loopback-datasource-juggler/lib/observer.js:172:22
pocketflint     |     at doNotify (/usr/src/pocketflint/node_modules/loopback-datasource-juggler/lib/observer.js:99:49)
pocketflint     |     at RestConnector.ObserverMixin._notifyBaseObservers (/usr/src/pocketflint/node_modules/loopback-datasource-juggler/lib/observer.js:122:5)
pocketflint     |     at RestConnector.ObserverMixin.notifyObserversOf (/usr/src/pocketflint/node_modules/loopback-datasource-juggler/lib/observer.js:97:8)
pocketflint     |     at cbForWork (/usr/src/pocketflint/node_modules/loopback-datasource-juggler/lib/observer.js:162:14)
pocketflint     |     at incomingTransform (/usr/src/pocketflint/node_modules/loopback-connector-flexirest/index.js:134:17)
pocketflint     |     at /usr/src/pocketflint/node_modules/loopback-datasource-juggler/lib/observer.js:181:9
pocketflint     |     at doNotify (/usr/src/pocketflint/node_modules/loopback-datasource-juggler/lib/observer.js:99:49)
pocketflint     |     at RestConnector.ObserverMixin._notifyBaseObservers (/usr/src/pocketflint/node_modules/loopback-datasource-juggler/lib/observer.js:122:5)
pocketflint     |     at RestConnector.ObserverMixin.notifyObserversOf (/usr/src/pocketflint/node_modules/loopback-datasource-juggler/lib/observer.js:97:8)
pocketflint     |     at RestConnector.ObserverMixin.notifyObserversAround (/usr/src/pocketflint/node_modules/loopback-datasource-juggler/lib/observer.js:150:15)
pocketflint     |     at /usr/src/pocketflint/node_modules/loopback-connector-flexirest/index.js:154:39
pocketflint     |     at errorHandler (/usr/src/pocketflint/node_modules/loopback-connector-flexirest/index.js:120:21)
pocketflint     |     at callback (/usr/src/pocketflint/node_modules/loopback-connector-flexirest/index.js:148:21)
pocketflint     |     at callback (/usr/src/pocketflint/node_modules/loopback-connector-flexirest/node_modules/loopback-connector-rest/lib/rest-builder.js:551:16)

@DerekTBrown
Copy link
Author

DerekTBrown commented Jun 22, 2017

Update:

I use flexirest to define a static method: /model/:id/ and a non-static method /model/:id/method. Calling /model/:id/method implicitly makes a call to /model/:id/ but has different arguments (4) instead of the normal 2. I needed to write wrapper methods to handle this, but an example should be added for overwriting existing methods.

@pbhadauria2000
Copy link
Member

Thanks @DerekTBrown for reporting this. I some how missed on this issue. Let me take a look at it this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants