title: Request Size is too large
body: <p>I have written the Stored procedure for bulkInsert where I am handling the SP's timeout as well. Still I am getting "Request size is too large" exception while executing the SP. Giving below the SP. Please help me, where I am wrong. I have taken all the code from pluralsight only. and handling in the same way like they have.</p>
  
  <pre><code>function spBulkInsert(docs){
      if (!docs) {
          throw new Error('Documents array is null or not defined!');
      }
      var context = getContext();
      var collection = context.getCollection();
      var response = context.getResponse();
  
      var docCount = docs.length;
  
      if (docCount == 0) {
          response.setBody(0);
          return;
      }
      var count = 0;
      createDoc(docs[0]);
  
      function createDoc(doc) {
          var isAccepted = collection.createDoucument(collection.getSelfLink(), doc, docCreated);
          if (!isAccepted) {
              response.setBody(count);
          }
      }
      function docCreated(err, doc) {
          if (err) throw err;
          count++;
          if (count == docCount) response.setBody(count);
          else createDoc(docs[count]);
      }
  };
  </code></pre>
  
  <p>Code for handling above SP:</p>
  
  <pre><code>var totalInsertedCount=0;
                  while (totalInsertedCount &lt; data.Count)
                  {
                      var insertedCount = await client.ExecuteStoredProcedureAsync&lt;int&gt;(
                                              UriFactory.CreateStoredProcedureUri("TestDoc", "coll", "spBulkInsert"),
                                              new RequestOptions { PartitionKey = new PartitionKey("partitionKey") }, data);
                      totalInsertedCount += insertedCount;
                      Console.WriteLine("Inserted {0} documents ({1} total, {2} remaining)", insertedCount, totalInsertedCount, data.Count - totalInsertedCount);
                      data= data.GetRange(insertedCount, data.Count - insertedCount);
                  }
  </code></pre>