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

Using built-in user model #2

Open
Andre197789xh opened this issue Dec 23, 2014 · 6 comments
Open

Using built-in user model #2

Andre197789xh opened this issue Dec 23, 2014 · 6 comments

Comments

@Andre197789xh
Copy link

Hi,

i try to use the connector with the built-in user model. This works fine (also for other, non built-in models) as long as i do not attach the ACL-model to the couchbase datasource. If i do, i get this error in the explorer console (even when doing requests to other, non built-in models):

{
"error": {
"name": "Error",
"status": 500,
"message": "inq is an unknown key",
"statusCode": 500,
"stack": "Error: inq is an unknown key\n at defaultHandler (C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\strong-remoting\lib\rest-adapter.js:337:15)\n at restErrorHandler (C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\strong-remoting\lib\rest-adapter.js:327:14)\n at Layer.handle_error (C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\express\lib\router\layer.js:58:5)\n at trim_prefix (C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\express\lib\router\index.js:269:13)\n at C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\express\lib\router\index.js:238:9\n at Function.proto.process_params (C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\express\lib\router\index.js:313:12)\n at C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\express\lib\router\index.js:229:12\n at Function.match_layer (C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\express\lib\router\index.js:296:3)\n at next (C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\express\lib\router\index.js:190:10)\n at Layer.handle_error (C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\express\lib\router\layer.js:54:12)"
}
}

This is my setup for datasources.json and model-config.json:

{
"db": {
"name": "db",
"connector": "memory"
},
"couchbase": {
"connector": "couchbase",
"database": "user_bucket"
}
}

{
...
"User": {
"dataSource": "couchbase",
"public": true
},
"AccessToken": {
"dataSource": "couchbase",
"public": true
},
"ACL": {
"dataSource": "couchbase",
"public": true
},
"RoleMapping": {
"dataSource": "couchbase",
"public": true
},
"Role": {
"dataSource": "couchbase",
"public": true
},
"Note": {
"dataSource": "couchbase",
"public": true
}
}

If i set ACL-datasource back to use the in-memory db everything works fine!? Do you have any clue whats going on?

@nolandubeau
Copy link
Contributor

Hi Andre,

Can you provide a sample of your models? We haven't done extensive testing
of the built-in models attached to couchbase, so there may be some bugs
there. We have primarily tested with non-built-in models. Also, there
will be an update to the connector coming in the next couple of days
hopefully.

Nolan

On Tue, Dec 23, 2014 at 7:09 AM, Andre197789xh [email protected]
wrote:

Hi,

i try to use the connector with the built-in user model. This works fine
(also for other, non built-in models) as long as i do not attach the
ACL-model to the couchbase datasource. If i do, i get this error in the
explorer console (even when doing requests to other, non built-in models):

{
"error": {
"name": "Error",
"status": 500,
"message": "inq is an unknown key",
"statusCode": 500,
"stack": "Error: inq is an unknown key\n at defaultHandler
(C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\strong-remoting\lib\rest-adapter.js:337:15)\n
at restErrorHandler
(C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\strong-remoting\lib\rest-adapter.js:327:14)\n
at Layer.handle_error
(C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\express\lib\router\layer.js:58:5)\n
at trim_prefix
(C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\express\lib\router\index.js:269:13)\n
at
C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\express\lib\router\index.js:238:9\n
at Function.proto.process_params
(C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\express\lib\router\index.js:313:12)\n
at
C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_module
s\expres s\lib\router\index.js:229:12\n at Function.match_layer
(C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\express\lib\router\index.js:296:3)\n
at next
(C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\express\lib\router\index.js:190:10)\n
at Layer.handle_error
(C:\Users\Andre\WebstormProjects\couchbase-neu\node_modules\loopback\node_modules\express\lib\router\layer.js:54:12)"
}
}

This is my setup for datasources.json and model-config.json:

{
"db": {
"name": "db",
"connector": "memory"
},
"couchbase": {
"connector": "couchbase",
"database": "user_bucket"
}
}

{
...
"User": {
"dataSource": "couchbase",
"public": true
},
"AccessToken": {
"dataSource": "couchbase",
"public": true
},
"ACL": {
"dataSource": "couchbase",
"public": true
},
"RoleMapping": {
"dataSource": "couchbase",
"public": true
},
"Role": {
"dataSource": "couchbase",
"public": true
},
"Note": {
"dataSource": "couchbase",
"public": true
}
}

If i set ACL-datasource back to use the in-memory db everything works
fine!? Do you have any clue whats going on?


Reply to this email directly or view it on GitHub
#2.

_Nolan Dubeau_VP, Engineering, Guardly Corp.
Online: https://www.guardly.com
LinkedIn: http://www.linkedin.com/in/nolandubeau
20 Maud Street, Suite 307, Toronto, ON M5V 2M5
CA (416) 434-8029 | US (650) 262-3599 | Skype: nolandubeau
Please consider the environment before printing this email.

@Andre197789xh
Copy link
Author

Hi Nolan,

thanks for your reply. I just setup a simple project, i did not extend any of the built-in models. I added an own "Note"-model, and as stated before, this works (CRUD) in Couchbase server. Also all the other models (User, AccessToken, RoleMapping, Role) work. Problem is the "ACL"-model, if i set this to use the "couchbase"-datasource nothing works anymore and i get the exception mentioned in my first post.

So this is the only model i defined in the whole project:

{
"name": "Note",
"base": "PersistedModel",
"properties": {
"title": {
"type": "string",
"required": true
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": []
}

Thanks

@nolandubeau
Copy link
Contributor

@ecguardly, I have repoduced this issue however do not know why it is occurring at this point. try cloning this repo and updating the db/model configs to use couchbase - https://github.com/strongloop/loopback-example-access-control. If by chance you come across this issue - https://groups.google.com/forum/#!topic/strongloop/R8XvXvvE1ho, it can be resolved by running npm install loopback-connector-couchbase --save. I got this issue by copying the connector from an another project as opposed to using npm to install.

@nolandubeau
Copy link
Contributor

We are in the process of writing a fix for this as some of the functionality for WHERE clauses was not completed.

@nolandubeau
Copy link
Contributor

Hi, we have published a new version of the connector, which should fix this issue. Please test and let us know.

@Andre197789xh
Copy link
Author

Hi, thanks, thats great. I have tested it and it works without any flaws so far...Thanks for your efforts!

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