#NestJS standalone didn't call error when it import scoped service

2 messages · Page 1 of 1 (latest)

distant oriole
#

I'm using the standalone nestjs and web app nestjs
When I mistakenly loaded a service with scope in the standalone version, the service became undefined in the standalone app
I think it's not a problem with not being able to read it (since the scope is a function of the web app side)
However, I thought it would be better to display the unreadable content as an error instead of undefined
I didn't know where to ask, so I posted here

Thanks for providing a great framework

Minimum reproduction code
https://stackblitz.com/edit/nestjs-typescript-starter-scnjjx

keen sphinx
#

Technically, it might be hard to properly determine when to throw the exception or not, due to the fact that the class might inject a request scoped provider, but not use it in the method that's being called in the createApplicaitonContext setting.

With nest-commander I got around this by having a module provide an explicit REQUEST provider that was singleton scoped, and there's a new @RequestModule() decorator that handles that for devs if they need it.