brianc/node-postgres-docs

Cannot read property 'handleCommandComplete' of null or Cannot read property handleDataRow

Closed this issue · 2 comments

Record insert or edit i have some errors (Cannot read property 'handleCommandComplete' of null or Cannot read property handleDataRow).

PG Version ^8.6.0,
Node Version 12.16.1,
Typeorm Version ^0.2.32.

After changes i was solve my problem in node_modules =>pg=>lib=>client.js
_handleDataRow(msg) {
if (this.activeQuery !== null) { // new line added
this.activeQuery.handleDataRow(msg)

}

_handleCommandComplete(msg) {
if (this.activeQuery !== null) { //new line added
this.activeQuery.handleCommandComplete(msg, this.connection)
}

Please describe in detail what you did to encounter the bug, either in brianc/node-postgres#1872 or a new issue on brianc/node-postgres. (See brianc/node-postgres#1685 for why this patch isn’t applied.)

  • Data is saved in the code below but client.js cannot read property 'handleCommandComplete' error so I have made changes as above.

=> app.module.ts

@module({
imports: [TypeOrmModule.forRoot({
type: 'postgres',
host: process.env.HOST,
port: parseInt(process.env.PORT),
username: process.env.USER,
synchronize: false,
logger: "debug",
logging: true,
entities: ["dist/**/entity.js"]
}),

=> entity.ts

@entity('doc.organizations')
export class OrganizationsEntity extends BaseEntity {

@PrimaryGeneratedColumn('uuid') orgId: string;
@Column('text') orgName: string;
@Column('text') description: string;
@Column('simple-json') address: object
@Column('text') email: string;
@Column('text') mobile: string;
@Column('timestamp', { generated: true }) createdAt: string;

}

=>app.service.ts

class AppService {
constructor(@InjectRepository(OrganizationsEntity) private readonly orgService: Repository)

public async CreateOrganization(body) {
try {
const result = await this.orgService.insert(body);
console.log("success",result);

} catch (e) {
 ocnsole.log("error",e);
}

}
}