Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NestJS - When accessing a blacklistPaths path it throws error if there is a global filter #19

Open
Calisto184AC0 opened this issue Jun 12, 2024 · 3 comments
Assignees

Comments

@Calisto184AC0
Copy link

Calisto184AC0 commented Jun 12, 2024

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
@JustSteveKing
Copy link

Hey @Calisto184AC0 thanks for pointing this out! I will ask @nikme or @Treblle/treblle-internal to have a look into this for you

@nikme
Copy link
Member

nikme commented Jun 13, 2024

Hi, I am looking into this.

@nikme nikme self-assigned this Jun 13, 2024
@nikme
Copy link
Member

nikme commented Jun 24, 2024

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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants