Open medikoo opened 4 years ago
Interesting. @Pavel910 what you think of this?
@eahefnawy yeah, it is problem unfortunately :( Without this crazy Proxy
thing, when the CLI tries to fetch a custom method on a Template
instance - it will fail.
I totally agree this Proxy
thing is far from ideal. Since Template
is so baked in at the CLI level, maybe it should have something like hasMethod(method)
and executeMethod(method)
which would be called by CLI? Then we could remove this Proxy voodoo. it would only require a small change to the CLI in case of a Template
component, and a small addition to Template
component only, and the Proxy thing would be gone.
Also, I suggest maybe we should remove this custom method
feature until better times.
Access of any core property (as
hasOwnProperty
) or not existing property returns a method as generated bycreateCustomMethodHandler
This may turn nasty, when we pass such object to any generic util, or if any developer decides to handle it in some outer module.
It's caused by optimistic Proxy setup: https://github.com/serverless/template/blob/fdc1924136d13e06200917cced8227de53b6d2b3/serverless.js#L31