NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

Ubuntu nuget push fails when depending on Grpc.AspNetCore and compiling sources #9009

Open jomonson opened 4 years ago

jomonson commented 4 years ago

NuGet product used (dotnet.exe): dotnet.exe --version (3.1.100):

OS version (Ubuntu WSL subsystem 18.04LTS):

Worked before? If so, with which NuGet version: Works on Windows using NuGet.exe

Detailed repro steps so we can see the same problem

  1. Create a csproj file with the following:
    <Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <Platforms>x64</Platforms>
    <PlatformTarget>x64</PlatformTarget>
    <DebugType>portable</DebugType>
    <DebugSymbols>true</DebugSymbols>
    <PackageId>SomeId</PackageId>
    <Version>1.0.3</Version>
    <Authors>whatever</Authors>
    <Company>whatever</Company>
    <RepositoryUrl>https://github.com/private/private2</RepositoryUrl>
    </PropertyGroup>
    <ItemGroup>
    <Protobuf Include="../**/*.proto" ProtoRoot=".." GrpcServices="Both"/>
    <PackageReference Include="Grpc.AspNetCore" Version="2.23.2"/>
    </ItemGroup>
    </Project>

    have a sample .proto file. have a nuget.config file:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <packageSources>
        <add key="github" value="https://nuget.pkg.github.com/private/index.json" />
    </packageSources>
    <packageSourceCredentials>
        <github>
            <add key="Username" value="whatever" />
            <add key="ClearTextPassword" value="private3" />
        </github>
    </packageSourceCredentials>
    </configuration>

    run: dotnet pack --configuration Release dotnet nuget push bin/Release/SomeId.1.0.3.nupkg -s github

The above fails. The above works only if removing <PackageReference Include="Grpc.AspNetCore" Version="2.23.2"/> from the .csproj or if specifying GRPC not to build the sources.

The resulting .nupkg files differ from 4kb to 140kb. Looking in Wireshark, I see that the DNS requests differ in order when executing the working version versus when executing the non-working version. The working version executes A and then AAAA to nuget.pkg.github.com and is responded with first A and then AAAA. The non-working version executes A and then AAAA to the same url but gets first the AAAA and then the A responses. I don't know if that's related but the later exchange of packets is done on different ips.

The resulting logs for the failing version is as follows:

warn : No API Key was provided and no API Key could be found for 'https://nuget.pkg.github.com/private'. To save an API Key for a source use the 'setApiKey' command.
info : Pushing SomeId.1.0.3.nupkg to 'https://nuget.pkg.github.com/private'...
info :   PUT https://nuget.pkg.github.com/private/
info : An error was encountered when fetching 'PUT https://nuget.pkg.github.com/private/'. The request will now be retried.
info : An error occurred while sending the request.
info :   The response ended prematurely.
info :   PUT https://nuget.pkg.github.com/private/
info : An error was encountered when fetching 'PUT https://nuget.pkg.github.com/private/'. The request will now be retried.
info : An error occurred while sending the request.
info :   The response ended prematurely.
info :   PUT https://nuget.pkg.github.com/private/
error: An error occurred while sending the request.
error:   The response ended prematurely.

Verbose Logs

dotnet nuget push does not contain a verbosity diag flag. error: Unrecognized option '--verbosity'

tried using -n false and it didn't help

jomonson commented 4 years ago

Might be related to these: https://github.com/rynowak/opulence/issues/4 https://github.com/NuGet/Home/issues/8580

nkolev92 commented 4 years ago

@jomonson

Are you still facing this problem?

GitHub requires that the repositoryId element is specified in order to accept a pushed package. Is that set-up correctly?

Thanks.

ckapatch commented 4 years ago

Hello @nkolev92 I am having this exact problem but don't have a RepositoryId element. What does that refer to? Thanks

nkolev92 commented 4 years ago

Hey @ck

I'm not sure I understand the question :)

GH requires you to have a repository element in https://www.nuget.org/packages/nuget.packaging.

The url should be repo you are pushing the package to.

ckapatch commented 4 years ago

@nkolev92 Yes the RepositoryUrl property is filled. But you're talking about a property named repositoryId. Which may be the same thing? Or you could mean the PackageId property.

In any case if you run the command enough times (in-between 4-20) the package will eventually push (via command line). Maybe you get lucky through the pipeline but the error is the same.

Something seems to be broken inside either Githubs hosting of the nuget feed or the nuget service prematurely killing the request.


Just to be clear, the issue I'm having has nothing to do with the Grpc.AspNetCore. I'm not referencing that but am getting the exact same error message on the push.