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
I faced with error "Cannot read properties of undefined (reading 'raw')". Here's the error stack:
err: {
"type": "Error",
"message": "Cannot read properties of undefined (reading 'raw')",
"stack":
TypeError: Cannot read properties of undefined (reading 'raw')
at /usr/src/server/node_modules/nestjs-pino/LoggerErrorInterceptor.js:19:52
at Observable.init [as _subscribe] (/usr/src/server/node_modules/rxjs/src/internal/observable/throwError.ts:125:68)
at Observable._trySubscribe (/usr/src/server/node_modules/rxjs/src/internal/Observable.ts:244:19)
at /usr/src/server/node_modules/rxjs/src/internal/Observable.ts:234:18
at Object.errorContext (/usr/src/server/node_modules/rxjs/src/internal/util/errorContext.ts:29:5)
at Observable.subscribe (/usr/src/server/node_modules/rxjs/src/internal/Observable.ts:220:5)
at /usr/src/server/node_modules/rxjs/src/internal/operators/catchError.ts:120:25
at OperatorSubscriber._this._error (/usr/src/server/node_modules/rxjs/src/internal/operators/OperatorSubscriber.ts:52:13)
at OperatorSubscriber.Subscriber.error (/usr/src/server/node_modules/rxjs/src/internal/Subscriber.ts:91:12)
at OperatorSubscriber.Subscriber._error (/usr/src/server/node_modules/rxjs/src/internal/Subscriber.ts:124:24)
}
Here is the diff that solved my problem:
diff --git a/node_modules/nestjs-pino/LoggerErrorInterceptor.js b/node_modules/nestjs-pino/LoggerErrorInterceptor.js
index a0a3b29..f9300a6 100644
--- a/node_modules/nestjs-pino/LoggerErrorInterceptor.js+++ b/node_modules/nestjs-pino/LoggerErrorInterceptor.js@@ -14,12 +14,14 @@ let LoggerErrorInterceptor = class LoggerErrorInterceptor {
return next.handle().pipe((0, rxjs_1.catchError)((error) => {
return (0, rxjs_1.throwError)(() => {
const response = context.switchToHttp().getResponse();
- const isFastifyResponse = response.raw !== undefined;- if (isFastifyResponse) {- response.raw.err = error;- }- else {- response.err = error;+ if (response) {+ const isFastifyResponse = response.raw !== undefined;+ if (isFastifyResponse) {+ response.raw.err = error;+ }+ else {+ response.err = error;+ }
}
return error;
});
@@ -30,4 +32,4 @@ LoggerErrorInterceptor = __decorate([
(0, common_1.Injectable)()
], LoggerErrorInterceptor);
exports.LoggerErrorInterceptor = LoggerErrorInterceptor;
-//# sourceMappingURL=LoggerErrorInterceptor.js.map
\ No newline at end of file
+//# sourceMappingURL=LoggerErrorInterceptor.js.map§
\ No newline at end of file
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
[email protected]
for the project I'm working on.I faced with error "Cannot read properties of undefined (reading 'raw')". Here's the error stack:
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: