loopback-auditz
loopback-auditz copied to clipboard
type must be either an array or a string.
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.
Did you ever get a solution to this?