From 9d5222a91ecb1caa910d261fec7a3a2b60542512 Mon Sep 17 00:00:00 2001 From: Peter van Gulik Date: Wed, 25 Jan 2023 15:38:38 +0100 Subject: [PATCH] fix: the refreshFn cannot be set when refresh delegates is undefined --- packages/salesforce/src/connection/salesforceConnection.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/salesforce/src/connection/salesforceConnection.ts b/packages/salesforce/src/connection/salesforceConnection.ts index 831fef45..fd123492 100644 --- a/packages/salesforce/src/connection/salesforceConnection.ts +++ b/packages/salesforce/src/connection/salesforceConnection.ts @@ -77,7 +77,9 @@ export class SalesforceConnection extends Connection { this.tooling['_logger'] = new JsForceLogAdapter(this.logger); // Overwrite refresh function on refresh delegate - this['_refreshDelegate']['_refreshFn'] = SalesforceConnection.refreshAccessToken; + if (this['_refreshDelegate']) { + this['_refreshDelegate']['_refreshFn'] = SalesforceConnection.refreshAccessToken; + } } private static refreshAccessToken(_this: SalesforceConnection, callback: (err: any, accessToken?: string, response?: any) => void) : Promise {