atls / nestjs

NestJS Custom Workshop
BSD 3-Clause "New" or "Revised" License
33 stars 8 forks source link

[bug] nestjs-map-errors-interceptor works incorrectly with nestjs >7 #195

Closed talentumtuum closed 3 years ago

talentumtuum commented 3 years ago

Описание бага

При использовании nestjs/common@7.0.13 и @nestjs/core@7.0.13 интерцептор выбрасывает ошибку

Материалы

identity-service_1  | TypeError: Cannot convert undefined or null to object
identity-service_1  |     at Function.values (<anonymous>)
identity-service_1  |     at mapErrors (/workspace/node_modules/@atlantis-lab/nestjs-map-errors-interceptor/dist/MapValidationErrorsInterceptor.js:25:80)
identity-service_1  |     at Array.reduce (<anonymous>)
identity-service_1  |     at CatchSubscriber.selector (/workspace/node_modules/@atlantis-lab/nestjs-map-errors-interceptor/dist/MapValidationErrorsInterceptor.js:32:51)
identity-service_1  |     at CatchSubscriber.error (/workspace/node_modules/rxjs/src/internal/operators/catchError.ts:130:23)
identity-service_1  |     at MergeMapSubscriber.SimpleOuterSubscriber.notifyError (/workspace/node_modules/rxjs/src/internal/innerSubscribe.ts:70:22)
identity-service_1  |     at SimpleInnerSubscriber._error (/workspace/node_modules/rxjs/src/internal/innerSubscribe.ts:34:17)
identity-service_1  |     at SimpleInnerSubscriber.Subscriber.error (/workspace/node_modules/rxjs/src/internal/Subscriber.ts:113:12)
identity-service_1  |     at SwitchMapSubscriber.Subscriber._error (/workspace/node_modules/rxjs/src/internal/Subscriber.ts:143:22)
identity-service_1  |     at SwitchMapSubscriber.Subscriber.error (/workspace/node_modules/rxjs/src/internal/Subscriber.ts:113:12)
identity-service_1  |     at /workspace/node_modules/rxjs/src/internal/util/subscribeToPromise.ts:12:30
talentumtuum commented 3 years ago

https://docs.nestjs.com/migration-guide#validation-errors-schema - нужно изменять validation-pipe конфигурацию