seanpmaxwell/overnight

overnight breaks when controllers and server are in separate projects.

Opened this issue · 0 comments

Recently, I started using project references from typescript to separate some common logic out into a separate package.
These projects both have their own package.json and node_modules folder. Which is where I think it breaks.

I went into the code to see what was happening, and the problem was that the addControllers function was not able to read the decorator metadata from the controllers I was providing it. There is no error thrown when this happens, the controller is silently not registered (this is achieved by returning null inside Server.prototype.getRouter on line 63 of the Server.js file in version 1.7.5).

I think it might be quite difficult to fix the issue of it not working when two separate node_mopdules folders are used. However, I do strongly believe that an error should be thrown instead of silently doing nothing, it cost me 4+ hours of looking through my code to find what was wrong when this could have easily been avoided.

If this is not desired behavior, maybe a simple log would be better?

P.S. I tested that this was the real cause, and it is, since when I simply moved the server file to the other project it worked again.