From 2994d7955c7a4fe986d67d4037f24aff5950cdfa Mon Sep 17 00:00:00 2001 From: Philipp Litzenberger Date: Wed, 29 Sep 2021 11:34:38 +0200 Subject: [PATCH] fix: request_id hashValue throws error (#500) --- packages/agent/src/request_id.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/agent/src/request_id.ts b/packages/agent/src/request_id.ts index c699f69a6..ea3e6deb8 100644 --- a/packages/agent/src/request_id.ts +++ b/packages/agent/src/request_id.ts @@ -30,8 +30,8 @@ function hashValue(value: unknown): ArrayBuffer { } else if (Array.isArray(value)) { const vals = value.map(hashValue); return hash(concat(...vals)); - } else if (value instanceof Principal) { - return hash(value.toUint8Array()); + } else if (typeof (value as Principal)?.toUint8Array === 'function') { + return hash((value as Principal).toUint8Array()); } else if ( typeof value === 'object' && value !== null &&