Closed sykire closed 6 years ago
This is where the problem begins, services rawInfo to be serialized includes actions params
:
I don't know how necessary is to serialize the params validation object, but joi's objects are cyclic and can't be serialized.
Possible solutions would be:
params
from actions
info. (easier)P.S.: Because moleculer validation is customizable, action params typings should be any
instead of Moleculer.ActionParams
, or perhaps passed as a generic. Will open and issue about that later.
Hi, the action properties are public information, what is used by middlewares. So we can't just omit if it's not working. We should check the action definition object and remove cyclic elements before broker sends them to the remote nodes. I'm thinking about it because it can be fixed in v0.13 (what I would like to release this week)
Sorry for bothering you again, I was looking to use Joi validator instead of default validator. After using the JoiValidator like in the example and setting the validation params in my actions I got this error:
It appears that the params validation object is tried to be serialized and because Joi objects are cyclic it fails.
This is not the first time I've seen problems with Joi object. There was a bug in Hoek.deepEqual when comparing objects that happens to have a joi object inside. This happens because Joi objects are cyclic. https://github.com/hapijs/hoek/issues/219
I've going to look further but at first impression it looks like the params validation object is tried to be serialized when it shouldn't.