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

Update-VSTeamRelease WARNING: VS402865: An empty body in the POST request is not allowed. #326

Closed
3 of 7 tasks
speedmind opened this issue May 25, 2020 · 9 comments
Closed
3 of 7 tasks
Assignees
Labels
bug when a bug has been identified or filed Investigating when an issue needs further investigation by a maintainer. Used only by maintainer.

Comments

@speedmind
Copy link

speedmind commented May 25, 2020

This issue is similar (if not identical) to #239 & #221 but is still present in the current release 6.4.8.
Please note that no modifications are being made to the release, so it's effectively been submitted as it arrives.

This occurs whenever the JSON request contains special characters and in our case I've identified a user with a special character in his name in the request under artifacts/definitionReference/requestedFor/id, but it could have been anywhere...

I've tried on Windows locally, but it also fails consistently on a Linux hosted agent (ubuntu-18.04) on AzD.

I've also captured the whole communication using fiddler and can provide it upon request.

Steps to reproduce

These are essentially the steps provided in the Update-VSTeamRelease reference documentation here:
https://github.com/DarqueWarrior/vsteam/blob/master/.docs/Update-VSTeamRelease.md

Set-VSTeamAccount -Account myAccount -PersonalAccessToken <redacted>
$r = Get-VSTeamRelease -ProjectName myProject -Id 999 -Raw
Update-VSTeamRelease -ProjectName myProject -Id 999 -release $r

Expected behavior
By modifying the Update-VSTeamRelease function locally I get the behavior below

Should return $r without any error similar to the one below

id                         : 999
name                       : Release-343
status                     : active
createdOn                  : 2020-05-25 14:08:18
modifiedOn                 : 2020-05-25 20:23:17
modifiedBy                 : @{…}
createdBy                  : @{…}
createdFor                 : @{…}
environments               : {@{…}…}
variables                  : @{…}
variableGroups             : {}
artifacts                  : {@{…}}
releaseDefinition          : @{…}
releaseDefinitionRevision  : 301
description                : Triggered by Repository:
                             Microsoft.VisualStudio.Services.ReleaseManagement.Server.Plugins.Model.GitRepository,
                             Branch: refs/heads/development, Commit Id: 2070.
reason                     : continuousIntegration
releaseNameFormat          : Release-$(rev:r)
keepForever                : False
definitionSnapshotRevision : 17
logsContainerUrl           : …
url                        : …
_links                     : @{self=; web=}
tags                       : {}
triggeringArtifactAlias    :
projectReference           : @{…}
properties                 :

Actual behavior

WARNING: VS402865: An empty body in the POST request is not allowed.
Invoke-RestMethod: C:\Users\vas\Documents\PowerShell\Modules\VSTeam\6.4.8\vsteam.functions.ps1:268
Line |
 268 |           $resp = Invoke-RestMethod @params
     |                   ~~~~~~~~~~~~~~~~~~~~~~~~~
     | {"$id":"1","innerException":null,"message":"VS402865: An empty body in the POST request is not
     | allowed.","typeName":"Microsoft.VisualStudio.Services.ReleaseManagement.Data.Exceptions.InvalidRequestException, Microsoft.VisualStudio.Services.ReleaseManagement2.Data","typeKey":"InvalidRequestException","errorCode":0,"eventId":3000}

Environment data

OS

  • macOS
  • Windows
  • Linux

Server

  • TFS 2017
  • TFS 2018
  • Azure DevOps Server
  • Azure DevOps Service
> Get-VSTeamAPIVersion
Name                           Value
----                           -----
Release                        5.1-preview
Tfvc                           5.0
Packaging                      5.1-preview
TaskGroups                     5.1-preview.1
Policy                         5.1
VariableGroups                 5.0-preview.1
ExtensionsManagement           5.1-preview
Version                        AzD
Git                            5.1-preview
Build                          5.1-preview
ServiceFabricEndpoint          5.0-preview
Core                           5.0
MemberEntitlementManagement    5.1-preview
DistributedTask                5.0-preview
Graph                          5.1-preview
> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      7.0.1
PSEdition                      Core
GitCommitId                    7.0.1
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
@SebastianSchuetze SebastianSchuetze added the Investigating when an issue needs further investigation by a maintainer. Used only by maintainer. label May 26, 2020
@SebastianSchuetze
Copy link
Collaborator

Thanks for reporting. We will check this.

@SebastianSchuetze
Copy link
Collaborator

SebastianSchuetze commented May 26, 2020

@speedmind could you provide the fiddle request? That would help a lot. Do you have sensitive data in the fiddler request?

@speedmind
Copy link
Author

speedmind commented May 26, 2020

It does, but I'll invalidate my PAT... Please delete once downloaded.
update: remove the download link

@DarqueWarrior
Copy link
Collaborator

What was the special character in the users name? I want to setup a test environment to duplicate.

@speedmind
Copy link
Author

speedmind commented Jun 7, 2020

What was the special character in the users name? I want to setup a test environment to duplicate.

Hi Donovan,
It's kind of strange. The character causing the issue is an unknown character
\xEF\xBF\xBD (�)
but the correct character should have been
\xC3\xA1 (á)

If you have access to the fiddler session I uploaded, you'll see that the requests No. 11, 20, 23, 50 & 56 submit the wrong (�) character but the responses No. 8, 23 & 56 return the correct character (á).

You can find the offending character by looking at either the request or the response using xPath: $.artifacts[1].definitionReference.requestedFor.id

Either way, when the request is submitted with charset=utf-8 (it was added manually by me in fiddler) in the Content-Type (see requests No. 23 & 56) the server seems to be happy (as opposed to requests No. 20 & 60 which fail without it).

Hope this clarifies the situation and I appreciate you looking into this,
Vas.

@DarqueWarrior
Copy link
Collaborator

I have a copy of the Fiddler log. I will find time to review. Thanks.

@SebastianSchuetze
Copy link
Collaborator

SebastianSchuetze commented Jun 20, 2020

I took a look and I can confirm that it is an encoding problem. Gonna fix it now.

@SebastianSchuetze
Copy link
Collaborator

fixing took a bit longer since I also implemented integration tests for this cmdlet. But PR is checked now and should go through.

@SebastianSchuetze SebastianSchuetze added the bug when a bug has been identified or filed label Jun 21, 2020
DarqueWarrior added a commit that referenced this issue Jul 28, 2020
* Update README.md

* Update README.md

* Fixed Update-VSTeamRelease WARNING: VS402865: An empty body in the POST request is not allowed. #326

* added integration tests for release definition

* fixed unit tests for changed implementation of content type

Co-authored-by: Sebastian Schütze <[email protected]>
@DarqueWarrior
Copy link
Collaborator

Fix will be in 6.5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug when a bug has been identified or filed Investigating when an issue needs further investigation by a maintainer. Used only by maintainer.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants