Skip to content

Commit f832891

Browse files
committed
Fix TypeError: Cannot read property 'length' of undefined
at _convertToBatch dynamics-web-api/lib/requests/sendRequest.js:117:40 The problem happens because we nullify _batchRequestId too early, before the batch request is made. With _batchRequestId it generates a new requestId, other than all operations were saved to, thus it crashes
1 parent e7379a4 commit f832891

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/dynamics-web-api.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,11 +1474,12 @@ function DynamicsWebApi(config) {
14741474
request.collection = '$batch';
14751475

14761476
_isBatch = false;
1477-
_batchRequestId = null;
1478-
return _makeRequest('POST', request, 'executeBatch')
1477+
const promise = _makeRequest('POST', request, 'executeBatch')
14791478
.then(function (response) {
14801479
return response.data;
14811480
});
1481+
_batchRequestId = null;
1482+
return promise;
14821483
};
14831484

14841485
/**

0 commit comments

Comments
 (0)