Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch execute suddenly stop working #2661

Closed
1 of 4 tasks
aselvini opened this issue May 3, 2023 · 6 comments
Closed
1 of 4 tasks

Batch execute suddenly stop working #2661

aselvini opened this issue May 3, 2023 · 6 comments

Comments

@aselvini
Copy link

aselvini commented May 3, 2023

Category

  • Enhancement
  • Bug
  • Question
  • Documentation gap/issue

Version

Please specify what version of the library you are using: [3.14.0]
Please specify what version(s) of SharePoint you are targeting: [SPO]

Expected / Desired Behavior / Question

How to debug an execute command that doesn't execute operations?
Could the Sharepoint configuration prevent the batching to work?

Observed Behavior

From one day to another, a function created to execute in a batch some operations halts just after the await execute() command: no messages are shown in the browser console and no new calls are made in the network panel.
The PnPLogging dumps this data:

Start execution...
Promise {<pending>}
Beginning request
Request Tag: PnPCoreJS:3.14.0:w.l.g.items
[81182c61-96f9-4b7d-9deb-49e3b10dfa53] Url: $theDomain/sites/$theSite/_api/web/lists/getByTitle($theList)/items
[81182c61-96f9-4b7d-9deb-49e3b10dfa53] Emitting auth
[506fb5df-1675-4ade-909b-8cfa6de20c36] Beginning request
Request Tag: PnPCoreJS:3.14.0:contextinfo
[506fb5df-1675-4ade-909b-8cfa6de20c36] Url: $theDomain/sites/$theSite/_api/contextinfo
[506fb5df-1675-4ade-909b-8cfa6de20c36] Emitting auth
[506fb5df-1675-4ade-909b-8cfa6de20c36] Emitted auth
[506fb5df-1675-4ade-909b-8cfa6de20c36] Emitting send
[batch:873afe47-0c77-4e4f-88b1-d0e3308741d2] (1683122006072) Adding request POST $theDomain/sites/$theSite/_api/contextinfo to batch.

The function was created months ago and worked without problems. No further changes has been done recently to the initialization of the sp object or other parts used by this feature. Even checking out an older versions of the code the problem persists.

Steps to Reproduce

I cannot paste the real code, I've create an example function that dumps the log above:

...
const sp = spfi().using(
  SPBrowser({
    baseUrl: `$theDomain/sites/$theSite`,
  })
)
sp.using(PnPLogging(LogLevel.Verbose));
...
const test = async () => {
  const listName = 'theListName';
  const [batchedSP, execute] = sp.batched();

  const list = batchedSP.web.lists.getByTitle(listName);
  list.items.add({ Title: 'Test 1 item' });

  window.console.log('Start execution...');
  try {
    await execute();
  } catch (e) {
    window.console.error(e);
  }
  window.console.log('End execution.');
};

The list has been created programmatically with pnpjs or manually via Sharepoint UI; as developer I don't have access to the main site configuration or the Sharepoint installation, so I didn't do any changes that could affect the behaviour but I don't even know if there are any.

Thanks for any suggestion!

@bcameron1231
Copy link
Collaborator

Hi. I was able to repro this using the SPBrowser. We'll take a look and see what the issue may be. Thanks!

@patrick-rodgers
Copy link
Member

patrick-rodgers commented May 3, 2023

Did it work and then you updated the library version? I ask because that would allow us to identify the code change potentially that led to trouble. If you could share the last working version it might help.

@aselvini
Copy link
Author

aselvini commented May 4, 2023

Thank you Patrick, my fault I didn't try this before. The last version working is the 3.11.0. I've tested 3.12.0, 3.12.1, 3.13.0 and 3.14.0 but in all these versions the behaviour is the same.

@bcameron1231
Copy link
Collaborator

I have located the issue, and working on a fix. Thank you for reporting this.

@bcameron1231
Copy link
Collaborator

Fixed, will be in the next release. Thanks for reporting it!

@github-actions
Copy link

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.

@github-actions github-actions bot locked and limited conversation to collaborators May 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants