Error: Action requires more operations in transaction than currently available

Hi, I’m getting this error while performing a Deep Save from a cloud service but I’m struggling to find any information about it. Presumably the operation is going above some set transaction operation limit but what is the limit and how can I work around it? Presumably I can break down the the amount being saved a once but then I lose the automatic rollback functionality of a transaction.

Thanks

Hello @Daniel_Maycock

Welcome to the Backendless Community.
The number of transactions available per transaction depends on the plan (you can see this both in the billing section and on our website with plan descriptions Backendless Cloud Pricing | Low Cost No-Code App Development Platform) Monosnap
If you don’t have enough transactions per transaction, you can buy additional pack in the marketplace Monosnap

Regards,
Inna

It’s a little obscure what triggers this error. I was deepSaving a three level deep structure and it took some testing to find that one of the nested levels contains an array that can contain 0 to N elements. I can’t limit the number of elements the user might add to the array, so buying a pack with 20 operations really won’t help. So is there any workaround that still allows the safety of a transaction?

I think elements in an array are saved with bulk create, so regardless of the array size, it would take one operation in a transaction.

Hi Mark, I’m probably doing something wrong or misunderstanding. All other things equal, given this structure:

{
  "phone": "blah",
  "detail": {
    "name": "blah blah",
  },
  "person": {
    "phone": "blahblah",
    "vehicles": [
      {
        "type": {
          "objectId": "BC7D8A16-7C30-4D7E-8F7A-F5178DE82220"
        },
        "pay": 150
      },
      {
        "type": {
          "objectId": "37ADC613-6B5A-48FE-85A8-EFE9A8946908"
        },
        "pay": 180,
        "objectId": "265BE981-BAC7-4644-BE24-48C382A3A682"
      },
      {
        "type": {
          "objectId": "4C273D3E-8FD7-437E-B41D-FB3BE3F1E10C"
        },
        "pay": 410,
        "objectId": "144ECC04-A8FD-49C6-B55D-10CEFDFFAD4F"
      },
      {
        "type": {
          "objectId": "4C273D3E-8FD7-437E-B41D-FB3BE3F1E10C"
        },
        "pay": 400,
        "objectId": "35FA123D-9326-4A3E-B1AB-AB80F6E4A838"
      }
    ],
    "objectId": "35B21A3F-6991-42DF-8849-9F36CA6F5033"
  },
  "objectId": "05F26450-3DE4-4E10-B814-569B42AE1D90"
}

If the Object->person->vehicles array has 1 to 4 elements, it works. Five or more throws:

Error: Action requires more operations in transaction than currently available
    at new ResponseError (/media/kelly/DEVO/elite/app/cloud-code/elite/node_modules/backendless-request/lib/index.js:42:116)
    at checkStatus (/media/kelly/DEVO/elite/app/cloud-code/elite/node_modules/backendless-request/lib/index.js:237:9)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

“detail” is a JSON column. The person relation is 1-to-1, the vehicles relation is 1-to-many, and sometimes some of its elements will already exist, as 3 of the 4 in the example do, when updating the “pay” values. My Cloud 9 plan says 10 operations, my intuition says the above example should take 3 or 4 if the bulkCreate only counts as 1. Hence my confusion.

I neglected to realize or mention that Object->person->vehicles->type is also a 1-to-1 relation, so this baby is actually 4 levels deep.

@Kelly_Oglesby did you ever figure this out? Sounds like Deep Save is limited to x-number of operations that lie under the hood, and a 1:N relation (where N child objects are created & related) will not work if there are ~10 children to be created in a single Deep Save transaction. Please share your insights :pray:

Alex, I’m so sorry, but my solution was to just avoid the problem entirely and not use the feature. My thinking was that, given that there IS a limit, if, because of your use case, you can’t guarantee a maximum number of transactions in the save, you will eventually encounter the limit, regardless of what the limit is. So I just scrapped what I was doing and did it differently.

:sweat_smile: ah ok, thanks for the insight.