Unspecific HTTP 500 on https://www.powershellgallery.com/api/v2/package/
ByteB4rb1e opened this issue · 1 comments
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Steps to reproduce
As instructed in the Use PowerShellGet to publish section of the PowerShellGallery Publishing Guidelines and Best Practices documentation, we have reasons for not using Publish-Module or Publish-Script and therefore am posting this issue here. It all comes down to a seperation of concerns, where the host responsible for publishing does not have a PowerShell runtime available. Therefore we are intending on using nuget push instead. We are using a private repository for testing, which works fine. We've published (for testing) to nuget.org, works fine.
ContosoSampleMod.nuspec:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>ContosoSampleMod</id>
<title>contoso.ContosoSampleMod</title>
<version>1.0.0</version>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A sample nuspec for recreating the issue</description>
<projectUrl>https://scm.contoso.com/contososamplemod</projectUrl>
<authors>Contoso</authors>
<owners>John Doe</owners>
<license type="expression">UNLICENSED</license>
<readme>.\README.md</readme>
<releaseNotes></releaseNotes>
<copyright>Contoso</copyright>
<tags>PSModule</tags>
</metadata>
<files>
<file src="src\**\*" target=""/>
<file src="README.md" target="" />
<file src="LICENSE*" target="" />
</files>
</package>
The resulting .nupkg from nuget pack is fine. Installing the module manually causes no problems.
Test-ModuleManifest returns no fault. The only difference we could see from packages manually downloaded from PowershellGallery was that they have a couple of tags which seem to be properties listed in the manifest (e.g. PSFunction_whatever).
Expected behavior
n/aActual behavior
n/aError details
$ nuget push dist/ContosoSample.1.0.0.nupkg \
-Source https://www.powershellgallery.com/api/v2/package/ \
-ApiKey NOTAREALAPIKEY \
-Verbosity 'Detailed'
NuGet Version: 6.6.1.2
Pushing ContosoSampleMod.1.0.0.nupkg to 'https://www.powershellgallery.com/api/v2/package'...
PUT https://www.powershellgallery.com/api/v2/package/
InternalServerError https://www.powershellgallery.com/api/v2/package/ 5062ms
PUT https://www.powershellgallery.com/api/v2/package/
InternalServerError https://www.powershellgallery.com/api/v2/package/ 526ms
PUT https://www.powershellgallery.com/api/v2/package/
InternalServerError https://www.powershellgallery.com/api/v2/package/ 472ms
Response status code does not indicate success: 500 (The given key was not present in the dictionary.).
System.Net.Http.HttpRequestException: Response status code does not indicate success: 500 (The given key was not present in the dictionary.).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode () [0x00040] in <4b5044e6dfa44dc49ac1a338967dfea4>:0
at NuGet.Protocol.Core.Types.PackageUpdateResource.EnsureSuccessStatusCode (System.Net.Http.HttpResponseMessage response, System.Nullable`1[T] codeNotToThrow, NuGet.Common.ILogger logger) [0x00044] in <239863218fce4f96b031c213d3d23b41>:0
at NuGet.Protocol.Core.Types.PackageUpdateResource+<>c__DisplayClass24_0.<PushPackageToServer>b__0 (System.Net.Http.HttpResponseMessage response) [0x00000] in <239863218fce4f96b031c213d3d23b41>:0
at NuGet.Protocol.HttpSource.ProcessResponseAsync[T] (NuGet.Protocol.HttpSourceRequest request, System.Func`2[T,TResult] processAsync, NuGet.Protocol.Core.Types.SourceCacheContext cacheContext, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x000f5] in <239863218fce4f96b031c213d3d23b41>:0
at NuGet.Protocol.Core.Types.PackageUpdateResource.PushPackageToServer (System.String source, System.String apiKey, System.String pathToPackage, System.Boolean noServiceEndpoint, System.Boolean skipDuplicate, System.TimeSpan requestTimeout, System.Boolean warnForHttpSources, NuGet.Common.ILogger logger, System.Threading.CancellationToken token) [0x004b3] in <239863218fce4f96b031c213d3d23b41>:0
at NuGet.Protocol.Core.Types.PackageUpdateResource.PushPackageCore (System.String source, System.String apiKey, System.String packageToPush, System.Boolean noServiceEndpoint, System.Boolean skipDuplicate, System.TimeSpan requestTimeout, System.Boolean warnForHttpSources, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x0017b] in <239863218fce4f96b031c213d3d23b41>:0
at NuGet.Protocol.Core.Types.PackageUpdateResource.PushPackagePath (System.String packagePath, System.String source, System.String symbolSource, System.String apiKey, System.Func`2[T,TResult] getSymbolApiKey, System.Boolean noServiceEndpoint, System.Boolean skipDuplicate, NuGet.Protocol.Core.Types.SymbolPackageUpdateResourceV3 symbolPackageUpdateResource, System.TimeSpan requestTimeout, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x00169] in <239863218fce4f96b031c213d3d23b41>:0
at NuGet.Protocol.Core.Types.PackageUpdateResource.Push (System.Collections.Generic.IList`1[T] packagePaths, System.String symbolSource, System.Int32 timeoutInSecond, System.Boolean disableBuffering, System.Func`2[T,TResult] getApiKey, System.Func`2[T,TResult] getSymbolApiKey, System.Boolean noServiceEndpoint, System.Boolean skipDuplicate, NuGet.Protocol.Core.Types.SymbolPackageUpdateResourceV3 symbolPackageUpdateResource, NuGet.Common.ILogger log) [0x00148] in <239863218fce4f96b031c213d3d23b41>:0
at NuGet.Commands.PushRunner.Run (NuGet.Configuration.ISettings settings, NuGet.Configuration.IPackageSourceProvider sourceProvider, System.Collections.Generic.IList`1[T] packagePaths, System.String source, System.String apiKey, System.String symbolSource, System.String symbolApiKey, System.Int32 timeoutSeconds, System.Boolean disableBuffering, System.Boolean noSymbols, System.Boolean noServiceEndpoint, System.Boolean skipDuplicate, NuGet.Common.ILogger logger) [0x00386] in <239863218fce4f96b031c213d3d23b41>:0
at NuGet.CommandLine.PushCommand.ExecuteCommandAsync () [0x0017c] in <239863218fce4f96b031c213d3d23b41>:0
at NuGet.CommandLine.Command.Execute () [0x000ea] in <239863218fce4f96b031c213d3d23b41>:0
at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) [0x001c7] in <239863218fce4f96b031c213d3d23b41>:0Environment data
$ nuget help
NuGet Version: 6.6.1.2
...Version
n/a
Visuals
No response
Never mind, we figured it out, works now with nuget push. To be honest, we're not quite understanding the approach the separation of powershellgallery and nuget is taking. It's still the same underlying system, yet documentation on implementation specifics is scarce and one has to dig through the PowerShellGet sources to understand on how to make www.powershellgallery.com happy... We would be pleased if the ecosystem was more open to other approaches instead of flat-out assuming incapability on the implementors side and forcing a specific implementation through this PowerShell module.
For anybody else not using PowerShellGet check out private/functions/Publish-PSArtifactUtility.ps1, which is invoked by public/psgetfunctions/Publish-Module.ps1. This will give you the implementation details on what's required in the .nuspec, as well as the module's manifest to make the www.powershellgallery.com repository host happy.