I tried to install Forest Admin on Nest Js.
Unfortunately it didn’t work in production because forest admin need to access to the “/forest” endpoint but it’s not possible for my team because our backend is behind a load balancer and we can only reach endpoint starting with “/api”.
I saw in the code that there is a prefix option which is supposed to allow this.
However the prefix option is not read from the option but from an hardcoded string.
The only way I found to bypass this hard written value was to create a monkey patch class which is awful and completely rely on private method of your lib… which is still in beta!
So it isn’t an option for us to deploy this in production.
EDIT: I opened a PR to fix it. When do you think it will merged and released? thanks !
PS: Here are a few tips if you want to improve the integration:
- types “any” make it really difficult to debug
- hard written values such as prefix are a pretty bad practice, but if you add some, you should change your types accordingly
- you shouldn’t import an heavy library like Koa when it’s not needed
- you should consider switching private methods to protected methods
- you should provide (export) the most important types
- if you wan to respect the Nest philosophy the integration should not be plugged at the application level but rather on a module
Here is the awful monkey patch we had to do:
All, since I can’t access to my dashboard
I cannot add a prefix in the agent url
I should be able to add a prefix in the agent url with the prefix option that seemed to have been created for that
- Project name: Capsule
- Team name: Founders
- Environment name: Development
- Agent type & version: “@forestadmin/agent”: “1.0.0-beta.46”
- Recent changes made on your end if any:
I just followed the install guide for NestJs and added the prefix options (visible in the type of the option object), because all my backend endpoint need to start with “/api”