We are using SP PnP JS inBatch method to batch requests but are getting error. Below is the sample code snippet.

  .filter("Filter condition")
  .then((items: any[]) => {

In the above code snippet we are putting inBatch(batch) just before get() method as mentioned over here. There are couple of other get requests written similarly and added to batch. But when we execute the batch we get error as below.

Error of browser console:

parsers.ts:15 Uncaught (in promise) Error: Error making HttpClient request in queryable: [400] Bad Request
    at new HttpRequestError (parsers.ts:15)
    at ODataDefaultParser.ODataParserBase.handleError (parsers.ts:61)
    at parsers.ts:31
    at new Promise (<anonymous>)
    at ODataDefaultParser.ODataParserBase.parse (parsers.ts:30)
    at clientsidepages.ts:6

Error for $batch request in network tab:

      "code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException",
         "value":"Invalid request."

If we put inBatch(batch) just after items then the batch executes but the batch.then does not execute after all the requests.

What is the issue here? Any way I can debug this error in a better way? As of now it shows just Bad Request.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.