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

type must be either an array or a string. #7

Open
itaimoorali opened this issue Dec 13, 2017 · 1 comment
Open

type must be either an array or a string. #7

itaimoorali opened this issue Dec 13, 2017 · 1 comment

Comments

@itaimoorali
Copy link

Hello there, I have integrated this component in my app.
I have encountered this issue when I define a custom remote method.

AssertionError [ERR_ASSERTION]: type must be either an array or a string.
    at TypeRegistry.getConverter (/home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/strong-remoting/lib/type-registry.js:83:3)
    at HttpContext.buildArgs (/home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/strong-remoting/lib/http-context.js:126:42)
    at new HttpContext (/home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/strong-remoting/lib/http-context.js:59:20)
    at restStaticMethodHandler (/home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/strong-remoting/lib/rest-adapter.js:485:15)
    at Layer.handle [as handle_request] (/home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/express/lib/router/layer.js:95:5)
    at /home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/express/lib/router/index.js:335:12)
    at next (/home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/express/lib/router/index.js:275:10)
    at Function.handle (/home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/express/lib/router/index.js:174:3)
    at router (/home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/express/lib/router/index.js:47:12)
    at Layer.handle [as handle_request] (/home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/express/lib/router/index.js:317:13)
    at /home/taimurali/blue-east-projects/mevris-cloud-2/node_modules/express/lib/router/index.js:284:7

When I debug the issue, i find out that loopback-component-remote-ctx is injecting a context instance to the accept array of remoteMethod with type Object which is causing the assertion to fail. I dont want the remoteCTX instance inside my remote method but i want the remote context in afterSave hook.
I cant add my remote method inside the blacklist array (property of options in loopback-component-remote-ctx) as its going to save anonymous inside my Audit model.
Please Help me with this.

@ewrayjohnson
Copy link

Did you ever get a solution to this?

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