Система баз данных / драйвер:
[x] postgres
`
TypeORM
Действия для воспроизведения или небольшой репозиторий показывая проблему: 1. Создайте объект: AuditLog
@Entity('audit_log')
export class AuditLog extends BaseEntity {
@PrimaryGeneratedColumn()
id: number;
@Column()
ip: string;
@Column({ type: 'varchar' })
url: string;
@Column({ name: 'method_name', type: 'varchar' })
methodName?: string;
@Column({ name: 'user_agent', type: 'varchar' })
userAgent?: string;
@Column({ name: 'status_code', type: 'varchar', length: 100 })
statusCode: string;
@Column({ name: 'err_msg', type: 'varchar', length: 100 })
errMsg?: string;
@Column({ name: 'err_trace', type: 'varchar', length: 100 })
errTrace?: string;
@Column({ name: 'req_body', type: 'json' })
reqBody?: JSON;
@Column({ type: 'json' })
request: JSON;
@Column({ type: 'json' })
response: JSON;
@Column({ name: 'response_time' })
responseTime: string;
@ManyToOne(type => User)
user?: User;
}
Сохранение сущности в базе данных с использованием метода репозитория, например:
async createLog(log: AuditLog): Promise<AuditLog> {
const result = await this.auditLogRepo.save(log);
return result;
}
Nest Js Перехватчик выполняет вызов этого метода службы.
UnhandledPromiseRejectionWarning: TypeError: Cannot assign to read only property 'writeQueueSize' of object '#<TCP>'
at Function.assign (<anonymous>)
at Function.OrmUtils.mergeDeep (/home/vineet/Haskell project/haskell_api/node_modules/typeorm/util/OrmUtils.js:89:28)
at Function.OrmUtils.mergeDeep (/home/vineet/Haskell project/haskell_api/node_modules/typeorm/util/OrmUtils.js:86:26)
at Function.OrmUtils.mergeDeep (/home/vineet/Haskell project/haskell_api/node_modules/typeorm/util/OrmUtils.js:86:26)
at Function.OrmUtils.mergeDeep (/home/vineet/Haskell project/haskell_api/node_modules/typeorm/util/OrmUtils.js:86:26)
at /home/vineet/Haskell project/haskell_api/node_modules/typeorm/persistence/Subject.js:210:33
at Array.reduce (<anonymous>)
at Subject.createValueSetAndPopChangeMap (/home/vineet/Haskell project/haskell_api/node_modules/typeorm/persistence/Subject.js:167:41)
at /home/vineet/Haskell project/haskell_api/node_modules/typeorm/persistence/SubjectExecutor.js:270:85
at Array.forEach (<anonymous>)
(node:2037) 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(). (rejection id: 2)
(node:2037) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Пожалуйста, помогите узнать, почему это идет не так?