OctoPack push to built-in repo throws null reference exception

Hi,

Sorry if this has already been posted - I searched but couldn’t find this exact error.

I’m running OctoPack on the same server that Octopus Deploy is running on, like so:

msbuild /t:Restore;Build "someproject.csproj" /m /p:Configuration=Release;Platform=x64;useenv=true /p:RunOctoPack=true;OctoPackEnforceAddingFiles=true /p:OctoPackPublishPackageToHttp=localhost:8888/nuget/packages;OctoPackPublishApiKey=<API key>

The error is:

The command ""C:\Users\LocNetworkService\.nuget\packages\octopack\3.6.3\build\nuget.exe" push "m:\workspace\Localeze_OctopusBuild\MAIN\src\product\webapp\SMBPortal\obj\octopacked\SMBPortal.1.0.0.0.nupkg" **** -Source localhost:8888/nuget/packages " exited with code 1.

So I ran it with just NuGet:

nuget push <package>.nupkg -ApiKey <API key> -Source localhost:8888/nuget/packages -verbosity detailed

And I got this error:

NuGet Version: 4.6.2.5055
Pushing SMBPortal.1.0.0.0.nupkg to 'localhost:8888/nuget/packages'...
System.NullReferenceException: Object reference not set to an instance of an object.
   at NuGet.Protocol.Core.Types.PackageUpdateResource.<PushPackageToServer>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.Core.Types.PackageUpdateResource.<PushPackageCore>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.Core.Types.PackageUpdateResource.<PushPackage>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.Core.Types.PackageUpdateResource.<Push>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Commands.PushRunner.<Run>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.CommandLine.PushCommand.<ExecuteCommandAsync>d__28.MoveNext()

I’m pretty lost. We have a proxy, but this is on the same server. Using p:OctoPackPublishPackageToFileShare works just fine. What am I missing? Thanks!

Lawrence

Hi Lawrence, thanks for reaching out.

I’ll need to get some more information to help resolve the issue.

  1. What is the server at localhost:8888? Is that the Octopus server, or another Nuget repository?
  2. If it is an Octopus server, what version is it?
  3. If the Octopus server is not the latest release, does upgrading it solve the issue?
  4. If you are publishing to the Octopus server, does uploading the file with the octo push command from the Octopus command line tool (https://octopus.com/docs/api-and-integration/octo.exe-command-line/pushing-packages) work with the same API key passed to OctoPack?
  5. Can you also attach the Octopus logs, as these might have some additional details (https://octopus.com/docs/support/log-files has details on finding the log files).

Regards
Matt C

Hey Matt,

Thanks for responding.

  1. Yep, that’s the Octopus server
  2. It’s running Octopus 2018.7.4
  3. I had the problem running some 3.x version, upgraded to 2018.7.4, and got the same error
  4. octo push gave me a super useful error message. Turns out I never gave the BuiltInFeedPush to the service account (I assumed service accounts had those permissions by default).

So the issue ended up being two-fold:

  1. /p:OctoPackPublishPackageToHttp=localhost:8888/nuget/packages is missing http:// (hah, figures)
  2. Didn’t have BuiltInFeedPush permissions on the service account

Thanks for all your help! Alerting me to octo.exe totally got me into the right direction. I do wish the initial error messages from msbuild and nuget were more informative, but presumably that’s not Ocotpus’ domain.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.