NestJS - When accessing a blacklistPaths path it throws error if there is a global filter
Expected result
When I use the blacklist key and a global filter, it does not throw any errors.
Description
When I try to access the path of the blacklist, I get the following error:
Error: Cannot set headers after they are sent to the client
This is my code:
// main.ts
const httpAdapterHost = app.get(HttpAdapterHost)
app.useGlobalFilters(new AllErrorsFilter(httpAdapterHost))
const constants = app.get(ConstantsService)
const expressInstance = app.getHttpAdapter().getInstance()
useNestTreblle(expressInstance, {
apiKey: constants.TREBLLE_API_KEY,
projectId: constants.TREBLLE_PROJECT_ID,
blacklistPaths: ['v1/health']
})
But when I remove the global filter, the blacklist does work.
| Info | Version |
|---|---|
| Node | v20.11.1 |
| @nestjs/core | v10.3.8 |
| treblle | v1.4.3 |
| OS | macOS 14.5 |
Hey @Calisto184AC0 thanks for pointing this out! I will ask @nikme or @Treblle/treblle-internal to have a look into this for you
Hi, I am looking into this.
Hi @Calisto184AC0, I have published new v1.5.0. I have managed to get the error and fixed it, as well as updated the naming, so please just take notice it is now "blocklistPaths".
@Calisto184AC0 v2 is out with much better support for path blocking