ai-traders / liget

NuGet server and cache running on kestrel in docker
MIT License
216 stars 29 forks source link

405 Method Not Allowed #14

Closed arnydo closed 5 years ago

arnydo commented 5 years ago

Hello, attempting to publish Powershell modules to Liget but receive a "405 - Method Not Allowed" error.

Has anyone else experienced this?

This is a fresh, unaltered Docker deployment of Liget..

info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.0 PUT http://localhost:9011/api/v3/index.json/ multipart/form-data; boundary=---------------------------8d6ade2e1fe5cb9 8784
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 0.2515ms 405 text/plain
info: Microsoft.AspNetCore.Server.Kestrel[32]
      Connection id "0HLLE04EDL5E7", Request id "0HLLE04EDL5E7:00000001": the application completed without reading the entire request body.
tomzo commented 5 years ago

Hi,

Thanks for creating the issue.

From the very brief log you provided, there seems to be a wrong endpoint that your nuget client is using. The HTTP PUT should go to /api/v2/package as in https://github.com/ai-traders/liget/blob/master/src/LiGet/CarterModules/PackagePublishModule.cs#L39 . But your log suggests there was a put at /api/v3/index.json/ which is just wrong.

It would be nice if you provided more information on how to reproduce the bug. Specifically:

PS: I am leaving on vacation tomorrow so I won't be able to look at this right away.

arnydo commented 5 years ago

I am using PowerShell. Registered the Repo with:

Register-PSRepository -Name "TestLiget" -SourceLocation "http://localhost:9011/api/v3/index.json" -PublishLocation "http://localhost:9011/api/v3/index.json" -InstallationPolicy "Trusted"

Attempt to publish PowerShell Module with:

❯ publish-module -Name PS-CoolModule -Repository TestLiget -NuGetApiKey $apikey -Verbose
VERBOSE: Repository details, Name = 'TestLiget', Location = 'http://localhost:9011/api/v3/index.json'; IsTrusted = 'True'; IsRegistered = 'True'.
VERBOSE: Repository details, Name = 'TestLiget', Location = 'http://localhost:9011/api/v3/index.json'; IsTrusted = 'True'; IsRegistered = 'True'.
VERBOSE: Publish Location:'http://localhost:9011/api/v3/index.json'.
VERBOSE: Module 'PS-CoolModule' was found in 'C:\Users\Me\Documents\WindowsPowerShell\Modules\PS-CoolModule'.
VERBOSE: Loading module from path 'C:\Users\Me\AppData\Local\Temp\337057159\PS-CoolModule\PS-CoolModule.psm1'.
VERBOSE: Repository details, Name = 'TestLiget', Location = 'http://localhost:9011/api/v3/index.json'; IsTrusted = 'True'; IsRegistered = 'True'.
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: Using the specified source names : 'TestLiget'.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'http://localhost:9011/api/v3/index.json' and PackageManagementProvider is 'NuGet'.
VERBOSE: Retry downloading 'http://localhost:9011/api/v3/index.json/FindPackagesById()?id='FoooBarr'' for '2' more times
VERBOSE: Retry downloading 'http://localhost:9011/api/v3/index.json/FindPackagesById()?id='FoooBarr'' for '1' more times
VERBOSE: Retry downloading 'http://localhost:9011/api/v3/index.json/FindPackagesById()?id='FoooBarr'' for '0' more times
VERBOSE: Total package yield:'0' for the specified package 'PS-CoolModule'.
VERBOSE: Performing the operation "Publish-Module" on target "Version '1.0' of module 'PS-CoolModule'".
Publish-PSArtifactUtility : Failed to publish module 'PS-CoolModule': 'Failed to process request. 'Method Not Allowed'.
tomzo commented 5 years ago

Can you try with:

Register-PSRepository -Name "TestLiget" -SourceLocation "http://localhost:9011/api/v3/index.json" -PublishLocation "http://localhost:9011/api/v2/package" -InstallationPolicy "Trusted"
arnydo commented 5 years ago

That did the trick. I appreciate the assistance!