Same Azure Cosmos DB one time it runs other time shows message Size is too large









up vote
0
down vote

favorite












I am writing Azure Cosmos DB stored procedure in azure portal , I am checking the what is max size response it can give initially it gave me 4.8 MB response later on any size more that it was showing error of message size is too large . Later on after 5 min executed same procedure and same parameters it was showing error of too large page size.



// SAMPLE STORED PROCEDURE


function sample(prefix)
var collection = getContext().getCollection();



// Query documents and take 1st item.
var isAccepted = collection.queryDocuments(
collection.getSelfLink(),
'SELECT r.data.truckSerialNo FROM root r',pageSize : -1,
function (err, feed, options) !feed.length)
var response = getContext().getResponse();
response.setBody('no docs found');

else 
console.log(feed.length);
var response = getContext().getResponse();
var body = prefix: prefix, feed: feed ;
var str = ;
str.x1 = body ;
str.x2 = body ;




response.setBody(JSON.stringify(str));

);

if (!isAccepted) throw new Error('The query was not accepted by the server.');




and error



Failed to execute stored procedure testProcedure for collection iotcollection: "code":400,"body":""code":"BadRequest","message":"Message: \"Errors\":[\"Encountered exception while executing function. Exception = Error: Resulting message would be too large because of \\\"Body\\\". Return from script with current message and use continuation token to call the script again or modify your script.\\r\\nStack trace: Error: Resulting message would be too large because of \\\"Body\\\". Return from script with current message and use continuation token to call the script again or modify your script.\\n at validateSize (bulkUpsert_v_1_0.js:177:25)\\n at setValueInternal (bulkUpsert\"]\r\nActivityId: d61226ab-4d5e-4a3d-aa09-83351649ce4c, Request URI: /apps/59d3b9ef-17ca-4bbf-8a11-39d0199a8d29/services/1b26e00f-1f51-4d34-88ec-4090b8e7db00/partitions/45a313b7-2cf2-419e-9885-48bf9cfe6277/replicas/131862936473830809p/, RequestStats: \r\nRequestStartTime: 2018-11-10T06:41:26.3320532Z, Number of regions attempted: 1\r\n, SDK: Microsoft.Azure.Documents.Common/2.1.0.0"","activityId":"d61226ab-4d5e-4a3d-aa09-83351649ce4c","substatus":413









share|improve this question

























    up vote
    0
    down vote

    favorite












    I am writing Azure Cosmos DB stored procedure in azure portal , I am checking the what is max size response it can give initially it gave me 4.8 MB response later on any size more that it was showing error of message size is too large . Later on after 5 min executed same procedure and same parameters it was showing error of too large page size.



    // SAMPLE STORED PROCEDURE


    function sample(prefix)
    var collection = getContext().getCollection();



    // Query documents and take 1st item.
    var isAccepted = collection.queryDocuments(
    collection.getSelfLink(),
    'SELECT r.data.truckSerialNo FROM root r',pageSize : -1,
    function (err, feed, options) !feed.length)
    var response = getContext().getResponse();
    response.setBody('no docs found');

    else 
    console.log(feed.length);
    var response = getContext().getResponse();
    var body = prefix: prefix, feed: feed ;
    var str = ;
    str.x1 = body ;
    str.x2 = body ;




    response.setBody(JSON.stringify(str));

    );

    if (!isAccepted) throw new Error('The query was not accepted by the server.');




    and error



    Failed to execute stored procedure testProcedure for collection iotcollection: "code":400,"body":""code":"BadRequest","message":"Message: \"Errors\":[\"Encountered exception while executing function. Exception = Error: Resulting message would be too large because of \\\"Body\\\". Return from script with current message and use continuation token to call the script again or modify your script.\\r\\nStack trace: Error: Resulting message would be too large because of \\\"Body\\\". Return from script with current message and use continuation token to call the script again or modify your script.\\n at validateSize (bulkUpsert_v_1_0.js:177:25)\\n at setValueInternal (bulkUpsert\"]\r\nActivityId: d61226ab-4d5e-4a3d-aa09-83351649ce4c, Request URI: /apps/59d3b9ef-17ca-4bbf-8a11-39d0199a8d29/services/1b26e00f-1f51-4d34-88ec-4090b8e7db00/partitions/45a313b7-2cf2-419e-9885-48bf9cfe6277/replicas/131862936473830809p/, RequestStats: \r\nRequestStartTime: 2018-11-10T06:41:26.3320532Z, Number of regions attempted: 1\r\n, SDK: Microsoft.Azure.Documents.Common/2.1.0.0"","activityId":"d61226ab-4d5e-4a3d-aa09-83351649ce4c","substatus":413









    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am writing Azure Cosmos DB stored procedure in azure portal , I am checking the what is max size response it can give initially it gave me 4.8 MB response later on any size more that it was showing error of message size is too large . Later on after 5 min executed same procedure and same parameters it was showing error of too large page size.



      // SAMPLE STORED PROCEDURE


      function sample(prefix)
      var collection = getContext().getCollection();



      // Query documents and take 1st item.
      var isAccepted = collection.queryDocuments(
      collection.getSelfLink(),
      'SELECT r.data.truckSerialNo FROM root r',pageSize : -1,
      function (err, feed, options) !feed.length)
      var response = getContext().getResponse();
      response.setBody('no docs found');

      else 
      console.log(feed.length);
      var response = getContext().getResponse();
      var body = prefix: prefix, feed: feed ;
      var str = ;
      str.x1 = body ;
      str.x2 = body ;




      response.setBody(JSON.stringify(str));

      );

      if (!isAccepted) throw new Error('The query was not accepted by the server.');




      and error



      Failed to execute stored procedure testProcedure for collection iotcollection: "code":400,"body":""code":"BadRequest","message":"Message: \"Errors\":[\"Encountered exception while executing function. Exception = Error: Resulting message would be too large because of \\\"Body\\\". Return from script with current message and use continuation token to call the script again or modify your script.\\r\\nStack trace: Error: Resulting message would be too large because of \\\"Body\\\". Return from script with current message and use continuation token to call the script again or modify your script.\\n at validateSize (bulkUpsert_v_1_0.js:177:25)\\n at setValueInternal (bulkUpsert\"]\r\nActivityId: d61226ab-4d5e-4a3d-aa09-83351649ce4c, Request URI: /apps/59d3b9ef-17ca-4bbf-8a11-39d0199a8d29/services/1b26e00f-1f51-4d34-88ec-4090b8e7db00/partitions/45a313b7-2cf2-419e-9885-48bf9cfe6277/replicas/131862936473830809p/, RequestStats: \r\nRequestStartTime: 2018-11-10T06:41:26.3320532Z, Number of regions attempted: 1\r\n, SDK: Microsoft.Azure.Documents.Common/2.1.0.0"","activityId":"d61226ab-4d5e-4a3d-aa09-83351649ce4c","substatus":413









      share|improve this question













      I am writing Azure Cosmos DB stored procedure in azure portal , I am checking the what is max size response it can give initially it gave me 4.8 MB response later on any size more that it was showing error of message size is too large . Later on after 5 min executed same procedure and same parameters it was showing error of too large page size.



      // SAMPLE STORED PROCEDURE


      function sample(prefix)
      var collection = getContext().getCollection();



      // Query documents and take 1st item.
      var isAccepted = collection.queryDocuments(
      collection.getSelfLink(),
      'SELECT r.data.truckSerialNo FROM root r',pageSize : -1,
      function (err, feed, options) !feed.length)
      var response = getContext().getResponse();
      response.setBody('no docs found');

      else 
      console.log(feed.length);
      var response = getContext().getResponse();
      var body = prefix: prefix, feed: feed ;
      var str = ;
      str.x1 = body ;
      str.x2 = body ;




      response.setBody(JSON.stringify(str));

      );

      if (!isAccepted) throw new Error('The query was not accepted by the server.');




      and error



      Failed to execute stored procedure testProcedure for collection iotcollection: "code":400,"body":""code":"BadRequest","message":"Message: \"Errors\":[\"Encountered exception while executing function. Exception = Error: Resulting message would be too large because of \\\"Body\\\". Return from script with current message and use continuation token to call the script again or modify your script.\\r\\nStack trace: Error: Resulting message would be too large because of \\\"Body\\\". Return from script with current message and use continuation token to call the script again or modify your script.\\n at validateSize (bulkUpsert_v_1_0.js:177:25)\\n at setValueInternal (bulkUpsert\"]\r\nActivityId: d61226ab-4d5e-4a3d-aa09-83351649ce4c, Request URI: /apps/59d3b9ef-17ca-4bbf-8a11-39d0199a8d29/services/1b26e00f-1f51-4d34-88ec-4090b8e7db00/partitions/45a313b7-2cf2-419e-9885-48bf9cfe6277/replicas/131862936473830809p/, RequestStats: \r\nRequestStartTime: 2018-11-10T06:41:26.3320532Z, Number of regions attempted: 1\r\n, SDK: Microsoft.Azure.Documents.Common/2.1.0.0"","activityId":"d61226ab-4d5e-4a3d-aa09-83351649ce4c","substatus":413






      azure-cosmosdb azure-cosmosdb-sqlapi






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 11 hours ago









      Amjath Khan

      355




      355



























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236915%2fsame-azure-cosmos-db-one-time-it-runs-other-time-shows-message-size-is-too-large%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236915%2fsame-azure-cosmos-db-one-time-it-runs-other-time-shows-message-size-is-too-large%23new-answer', 'question_page');

          );

          Post as a guest














































































          這個網誌中的熱門文章

          What does pagestruct do in Eviews?

          Dutch intervention in Lombok and Karangasem

          Channel Islands