You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for urls like example.com/statics/something the desired config of ThrottlerModuleOptions didn't work and I couldn't find documents for using guard in app.useGlobalGuards and test that, but I try below and got Error:
Error: Nest could not select the given module (it does not exist in current context)
at NestApplication.select (/root/app/packages/server-template/node_modules/@nestjs/core/nest-application-context.js:49:19)
at /root/app/packages/server-template/node_modules/@nestjs/core/nest-factory.js:127:40
at Function.run (/root/app/packages/server-template/node_modules/@nestjs/core/errors/exceptions-zone.js:9:13)
at Proxy.<anonymous> (/root/app/packages/server-template/node_modules/@nestjs/core/nest-factory.js:126:46)
at Proxy.<anonymous> (/root/app/packages/server-template/node_modules/@nestjs/core/nest-factory.js:168:54)
at /root/app/packages/server-template/src/main.ts:38:32
at Generator.next (<anonymous>)
at fulfilled (/root/app/packages/server-template/src/main.ts:5:58)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
But the desired config applied to other routes of nestjs controller correctly. This problem just happened for routes that ServeStaticModule provides for serving statics files.
for solving this issue i have to use express-rate-limit packages, and use its middleware like below code and it works fine:
If you look at the loaders in the serve-static package you'll see that it just uses app.use/app.register instead of having a full Nest context per route. Because of this, guards, interceptors, and other enhancers will not apply to the routes. The update would need to be made over in the nestjs/serve-static package, and there's nothing this package can do about it
mohamadnabikhani
changed the title
It not apply the desired config to ServeStaticModule module imported from @nestjs/serve-static
It didn't apply the desired config to ServeStaticModule module imported from @nestjs/serve-static
Jul 14, 2021
I'm submitting a...
Current behavior
example.com/statics/something
the desired config of ThrottlerModuleOptions didn't work and I couldn't find documents for using guard in app.useGlobalGuards and test that, but I try below and got Error:But the desired config applied to other routes of nestjs controller correctly. This problem just happened for routes that ServeStaticModule provides for serving statics files.
for solving this issue i have to use express-rate-limit packages, and use its middleware like below code and it works fine:
Expected behavior
It should apply desired config for statics root, too.
Environment
The text was updated successfully, but these errors were encountered: