Skip to content

fix: pattern exclude when no request url #11

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

Merged
merged 1 commit into from
Apr 24, 2025
Merged

fix: pattern exclude when no request url #11

merged 1 commit into from
Apr 24, 2025

Conversation

itaywol
Copy link
Contributor

@itaywol itaywol commented Apr 24, 2025

This pull request comes to solve issue of utilizing the context logger module in mixed nestjs services where the request interceptor is also invoked on controllers running kafka events (For example).

In general when the request.url isn't existing and the module is configured to exclude routes.

The problem:

TypeError: Cannot read properties of undefined (reading 'indexOf')
    at /app/node_modules/.pnpm/[email protected]_@[email protected][email protected]_class-validator@0._kd6lxe3k4jjyqgodhhwgygigzy/node_modules/nestjs-context-logger/dist/interceptors/request.interceptor.js:28:109
    at Array.some (<anonymous>)
    at RequestInterceptor.intercept (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected]_class-validator@0._kd6lxe3k4jjyqgodhhwgygigzy/node_modules/nestjs-context-logger/dist/interceptors/request.interceptor.js:28:81)
    at nextFn (/app/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]_fil_rcutrhibw77yyuhivdu4r53mra/node_modules/@nestjs/core/interceptors/interceptors-consumer.js:23:36)
    at /app/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]_fil_rcutrhibw77yyuhivdu4r53mra/node_modules/@nestjs/core/interceptors/interceptors-consumer.js:21:88
    at AsyncResource.runInAsyncScope (node:async_hooks:211:14)
    at bound (node:async_hooks:242:16)
    at Observable._subscribe (/app/node_modules/.pnpm/[email protected]/node_modules/rxjs/dist/cjs/internal/observable/defer.js:8:31)
    at Observable._trySubscribe (/app/node_modules/.pnpm/[email protected]/node_modules/rxjs/dist/cjs/internal/Observable.js:41:25)
    at /app/node_modules/.pnpm/[email protected]/node_modules/rxjs/dist/cjs/internal/Observable.js:35:31

I have added a test case to support this check.

@itaywol
Copy link
Contributor Author

itaywol commented Apr 24, 2025

btw, אחלה מודול !

@AdirD AdirD changed the title fix(request-interceptor): added support for request-less invocations … fix: pattern exclude when no request url Apr 24, 2025
@AdirD
Copy link
Owner

AdirD commented Apr 24, 2025

@itaywol oh my bad, thanks! 🚀
merged, you can find this in @1.6.1

@AdirD AdirD merged commit 889d1a8 into AdirD:main Apr 24, 2025
1 check passed
Copy link

🎉 This PR is included in version 1.6.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants