Skip to content

[BUG] When batching, Invoke-PnPSPRestMethod DELETE operations have multiple "IF-MATCH" headers #4837

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

Closed
3 of 6 tasks
joshtransient opened this issue Apr 6, 2025 · 4 comments
Assignees
Labels
bug Something isn't working pending PnP Core merge Waiting for a PR in PnP Core to be merged first reproduced Issue reproduced after testing

Comments

@joshtransient
Copy link

Expected behavior

New-PnPBatch should not be making requests with duplicate headers.

Actual behavior

Throws an error message: InvalidOperation: The header 'IF-MATCH' was specified multiple times. Each header must appear only once in a batch part.

Steps to reproduce behavior

Run this script (replacing @(1,2,3) with user IDs in the site with active PnP context:

$batch = New-PnPBatch
foreach($userId in @(1,2,3)) {
  Invoke-PnPSPRestMethod -Method DELETE -Url "/_api/Web/SiteUsers/GetById($userId)" -Batch $batch
}
$result = Invoke-PnPBatch -Batch $batch

What is the version of the Cmdlet module you are running?

2.12

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify
@joshtransient joshtransient added the bug Something isn't working label Apr 6, 2025
@KoenZomers KoenZomers added the reproduced Issue reproduced after testing label Apr 7, 2025
@KoenZomers KoenZomers self-assigned this Apr 7, 2025
@KoenZomers
Copy link
Collaborator

Thanks for the clear repro steps @joshtransient . On it.

@KoenZomers
Copy link
Collaborator

KoenZomers commented Apr 7, 2025

It will be fixed once this PR in PnP Core will be merged pnp/pnpcore#1635

@gautamdsheth
Copy link
Collaborator

hey @joshtransient , this has been fixed today.
Will be available in tomorrow's nightly builds as well as the next major version coming soon.

Thanks for raising this issue.

@joshtransient
Copy link
Author

Thank you @gautamdsheth and @KoenZomers for the quick turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending PnP Core merge Waiting for a PR in PnP Core to be merged first reproduced Issue reproduced after testing
Projects
None yet
Development

No branches or pull requests

3 participants