From 186ace329573bfdcb78dc75e81c742e4562ba4f5 Mon Sep 17 00:00:00 2001 From: Bret Harrison Date: Mon, 16 Jul 2018 12:38:20 -0400 Subject: [PATCH] FAB-11179 NodeSDK - Handle missing discovery NodeSDK should throw a better error when there are no endorsement targets. Change-Id: Id6c26b0ec81cd2d4575bb241ae8c8aeac7d0951a Signed-off-by: Bret Harrison --- fabric-client/lib/impl/DiscoveryEndorsementHandler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fabric-client/lib/impl/DiscoveryEndorsementHandler.js b/fabric-client/lib/impl/DiscoveryEndorsementHandler.js index 0f0da6c9d9..0196e47681 100644 --- a/fabric-client/lib/impl/DiscoveryEndorsementHandler.js +++ b/fabric-client/lib/impl/DiscoveryEndorsementHandler.js @@ -113,7 +113,7 @@ class DiscoveryEndorsementHandler extends api.EndorsementHandler { async _endorse(discovery_plan, request, proposal) { const method = '_endorse'; // see if we have an endorsement plan for the requested chaincode - if(discovery_plan && discovery_plan.endorsement_targets[request.chaincodeId]) { + if(discovery_plan && discovery_plan.endorsement_targets && discovery_plan.endorsement_targets[request.chaincodeId]) { logger.debug('%s - found discovery endorsement plan for %s', method, request.chaincodeId); const chaincode_plan = discovery_plan.endorsement_targets[request.chaincodeId]; chaincode_plan.endorsements = {};