Nestjs Swagger UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property `prototype` of 'undefined' or 'null'
Nestjs Swagger UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property `prototype` of 'undefined' or 'null'
我正在做一个 Nestjs REST API 项目,我必须在其中添加 swagger。我以这个 repo 为例:https://github.com/nestjs/nest/tree/master/sample/11-swagger
但我收到此错误:
UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property 'prototype' of 'undefined' or 'null'
和这个:
UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block or by rejecting a promise which was not handled with .catch().
项目在这里:
https://github.com/strdr4605/nestjs-rest-api/blob/swagger/src/main.ts
swagger的配置没问题。不确定,但可能是因为我在控制器和服务的 PUT/DELETE 方法中使用 ObjectID 作为一种 id。更改为字符串类型,一切正常。
我在 Swagger 尝试解析事件控制器内 Kafka 消息的有效负载时遇到问题,因此我添加了 ApiExcludeEndpoint
以排除消息处理程序
@ApiExcludeEndpoint()
@EventPattern('topic', Transport.KAFKA)
public async handleEvent(@Payload() message: EventDto): Promise<void> {
// ...
我正在做一个 Nestjs REST API 项目,我必须在其中添加 swagger。我以这个 repo 为例:https://github.com/nestjs/nest/tree/master/sample/11-swagger
但我收到此错误:
UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property 'prototype' of 'undefined' or 'null'
和这个:
UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block or by rejecting a promise which was not handled with .catch().
项目在这里:
https://github.com/strdr4605/nestjs-rest-api/blob/swagger/src/main.ts
swagger的配置没问题。不确定,但可能是因为我在控制器和服务的 PUT/DELETE 方法中使用 ObjectID 作为一种 id。更改为字符串类型,一切正常。
我在 Swagger 尝试解析事件控制器内 Kafka 消息的有效负载时遇到问题,因此我添加了 ApiExcludeEndpoint
以排除消息处理程序
@ApiExcludeEndpoint()
@EventPattern('topic', Transport.KAFKA)
public async handleEvent(@Payload() message: EventDto): Promise<void> {
// ...