Closed jsilva74 closed 5 months ago
Hi, have you reviewed this comment from this previous issue? I suspect the answer here applies to your situation as you are using the same queryable in each of your batches (sp.web).
https://github.com/pnp/pnpjs/issues/1711#issuecomment-828546078
Hi and thank you! I'll make the adjustments as proposed in the comment you've pointed out and see if it solves the problem.
Thanks again.
@bcameron1231 hi.
Sorry the delay but I had to wait a couple days to have some data to run the test. Worked but, for future reference, chain .inBatch before the action as sugested, didn't work - I had to keep it before the lists method e.g.:
sp.web.inBatch(batch).lists.getByTitle('List1').add()
sp.web.inBatch(batch).lists.getByTitle('List1').update()
Again, thank you.
This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.
What version of PnPjs library you are using
2.x (No longer supported)
Minor Version Number
2.15.0
Target environment
NodeJS
Additional environment details
I'm authenticating with pnp-auth package using credentials which uses @pnp/sp-commonjs (v2.15.0). Node version is 20.12.2.
Question/Request
Hello and appologies for my English - it's isn't my first (or second) language even.
I need to update 3 lists in one batch in a service which run daily and I'm getting the famous "This query is already part of a batch" error. Already had searched about it, read all mentions to it (docs, threads, etc) I've found. Now, I'm in the "begging for help" phase. So, my service has the follow structure (simplified for brevity):
The error occurrs if more than 1 sub-functions have any item to add or update, the next function fail with "This query is already part of a batch" (the first runs ok but the follow function fail).
If anyone could be kind enough to point me where/what I'm doing wrong and help me with this, I'll deeply appreciate. Good day/afternoom/evening to all.
PS: I'm aware that v2 isn't supported anymore but, anyway, ya all get my point...