Req/Res tokens return undefined
patrickmichalina opened this issue · 3 comments
I'm submitting a...
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
RESPONSE
and REQUEST
tokens return null.
Expected behavior
In server context, RESPONSE
and REQUEST
should give access to the objects from express.
(import { RESPONSE } from '@nguniversal/express-engine/tokens')
Minimal reproduction of the problem with instructions
Setup a new project with any service importing like so:
constructor(@Optional() @Inject(RESPONSE) res: any) {
console.log(res);
}
What is the motivation / use case for changing the behavior?
Environment
Nest version: 7.4.4
For Tooling issues:
- Node version: 14.12.0
- Platform: Mac
When I copied the entire library locally it works. I believe the issue has to do with the DI system not matching the correct tokens when consumed as an NPM package.
same here, after upgrading from 3.2.0
to 4.0.1
When I copied the entire library locally it works. I believe the issue has to do with the DI system not matching the correct tokens when consumed as an NPM package.
True. To overcome this issue, @nestjs/ng-univeral/tokens
will now (starting from the 4.1.0 version) re-export both REQUEST
and RESPONSE
tokens. Please, try to use them instead.