Custom XMLRPC node callbacks not firing

Hi

I’m trying to create a custom node to interact with a CRM system via XMLRPC. My problem is that the request callbacks/promises that I send (with node-xmlrpc) are not firing at all. The code runs without any issues on standalone node (tsc/node). Any ideas what might cause this? Thanks

export async function request(this: IExecuteFunctions, client: xmlrpc.Client, method: string, params: any[]): Promise<any> {

    return new Promise((resolve, reject) => {
        client.methodCall(method, params, function (error, value) {
            if (error) { reject(error); }
            resolve(value);
        })
    })

}

async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {

const items = this.getInputData();

let item: INodeExecutionData;
let myString: string;

let client = xmlrpc.createSecureClient({ host: 'redacted.odoo.com', port: 443, path: '/xmlrpc/2/common' })

request.call(this, client, "version", null).then((result: any) => {
	console.log(result)
}).catch((error: any) => {
	console.log(error)
})

...

}

@sne welcome to the community

Change:

request.call(this, client, "version", null).then((result: any) => {
	console.log(result)
}).catch((error: any) => {
	console.log(error)
})

to:

await request.call(this, client, "version", null)

1 Like

Using await solved the issue, thanks @RicardoE105 !

Sne, what do you think ? Do you plan to release your odoo node for the community ? I am very interessted.

Thanks,
Stefan