Code Monkey home page Code Monkey logo

Comments (25)

cannehag avatar cannehag commented on August 27, 2024 4

I have narrowed it down to that this occurs when using "dotnet restore". If I do "nuget.exe restore" it works all the time.

from artifacts-credprovider.

jotaylo avatar jotaylo commented on August 27, 2024 3

The issue is still being investigated with the help of the NuGet client team. In the meantime, clearing the nuget http-cache before running the install, as well as increasing plugin timeout values, seems to help.

nuget locals http-cache -c
$env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS=20
$env:NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20

from artifacts-credprovider.

djee-ms avatar djee-ms commented on August 27, 2024 1

NuGet 5.2.0 works for me, tried 2 builds of 10 agents, all passed. And the release notes of 5.2.0 point to many fixes around authentication, including NuGet/Home#8198 which very much look like the current issue. Thanks @satbai.

from artifacts-credprovider.

satbai avatar satbai commented on August 27, 2024

Thank you for reporting. Does this happen intermittently, and if so, what's the failure rate? In your pipeline, are you using a hosted or private agent? Seeing the whole log, including everything that both the NuGet build task and the cred provider writes, might help investigation.

from artifacts-credprovider.

mschofie avatar mschofie commented on August 27, 2024

It is intermittent. We had a 12 hour window when 4 of 7 CI builds failed with this issue. But we haven't hit it in the past ~24 hours. We are using private agents.

I took a look at the 4 recent instances, and 2 of them don't appear to have anything untoward in the logs, beyond what I already shared. The other 2, however, do have logs that suggest that spurious 401's were returned by the package source (all package sources that we're pulling from are Azure Artifact Feeds). I've attached those logs:

InterestingLog1.txt
InterestingLog2.txt

from artifacts-credprovider.

satbai avatar satbai commented on August 27, 2024

Thanks for the logs. I can see "Object reference not set to an instance of an object." in the logs, which is certainly interesting. Could you add a build variable system.debug = true in your pipeline and make sure the task has Verbosity set to detailed? After those settings the following logs should have more details. We need to determine whether this error is thrown by the cred provider or NuGet and hopefully the more verbose logs will help.

FYI @dtivel

from artifacts-credprovider.

satbai avatar satbai commented on August 27, 2024

I haven't been able to get a repro so I have a few more questions. When is the first time you started seeing this error? How many feeds do you have in your nuget.config? Are they all feeds from Azure DevOps Artifacts? Do you have a lot of packages you're restoring?

from artifacts-credprovider.

cannehag avatar cannehag commented on August 27, 2024

We have this problem at the moment also.

We are using NuGet.exe v4.9.3 on AzureDevOps, installed using the NuGetToolInstaller@0 and restore performing through "dotnet build" (dotnet 2.2.105).

This was intermittent for us for a while, but now we have a pipeline that we never get to pass because of this error.
C:\Program Files\dotnet\sdk\2.2.105\NuGet.targets(114,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/[org]/_packaging/[name]/nuget/v3/index.json. [D:\a\1\s\src[project][project].csproj]
C:\Program Files\dotnet\sdk\2.2.105\NuGet.targets(114,5): error : A task was canceled. [D:\a\1\s\src[project][project].csproj]

from artifacts-credprovider.

jeffkl avatar jeffkl commented on August 27, 2024

Possibly related to NuGet/Home#8198

from artifacts-credprovider.

satbai avatar satbai commented on August 27, 2024

According to the discussion in the related NuGet issue, the new version 5.1 should have some logging fixes that might help investigating this issue. Please try updating the NuGet version and see if the logs are more interesting.

from artifacts-credprovider.

mschofie avatar mschofie commented on August 27, 2024

Sorry for the delay in replying. I'll switch to NuGet 5.1 and keep an eye on things. Here's the details that satbai asked for back in May:

When is the first time you started seeing this error?
We'd seen it occasionally before (maybe a couple of times per week?), but a tight cluster of hits that took out half the builds in an afternoon (as I commented before) resulted in this issue.

How many feeds do you have in your nuget.config? Are they all feeds from Azure DevOps Artifacts?
At the time we had 7 feeds in nuget.config. All of them were from AzureDevOps. One of them Upstreamed nuget.org (which is how we 'proxy' nuget.org). To try and help with this incident I moved three of the feeds to be Upstreamed by the upstream feed we already had, leaving us with 4 feeds in Nuget.config.

Do you have a lot of packages you're restoring?
We restore ~140 packages.

from artifacts-credprovider.

Mys73rion avatar Mys73rion commented on August 27, 2024

I have narrowed it down to that this occurs when using "dotnet restore". If I do "nuget.exe restore" it works all the time.

Thanks a lot.
We had the same issue, and with your hint, using "nuget.exe restore", it works like a charm.

from artifacts-credprovider.

AMoghrabi avatar AMoghrabi commented on August 27, 2024

Hey team. I'm receiving a similar error when restoring on TeamCity:

[09:21:03][Execute nuget:restore]   https://pkgs.dev.azure.com/{company}/_packaging/{feed}/nuget/v3/index.json: Unable to load the service index for source https://pkgs.dev.azure.com/{company}/_packaging/{feed}/nuget/v3/index.json.
[09:21:03][Execute nuget:restore]   A task was canceled.

This is unfortunate because when I was testing Azure Artifacts everything worked fine. This also appears to be intermittent for us. I've moved 50,000 packages from our hosted server to Azure Artifacts and was hoping I can get this running today.

Can anyone advise what to do? We're using nuget.exe.

Edit: This may just be an authentication issue. Currently investigating.

Edit2: The error message is a bit misleading. I had to restart our build agents to pick up the environment variables. Thanks!

from artifacts-credprovider.

satbai avatar satbai commented on August 27, 2024

When reading the discussion related to the NuGet issue jeffkl mentioned earlier, it sounds like for those who see this error with nuget.exe, there might be a fix for this in the next version of NuGet that's coming up (version 5.2?).

from artifacts-credprovider.

djee-ms avatar djee-ms commented on August 27, 2024

We have a similar issue on Azure hosted agents (Hosted VS 2017). Unlike @cannehag, in our case nuget restore fails with the same error (and we cannot use dotnet restore). With 5.1.0 the following error is reported:

Problem starting the plugin 'D:\a\_tasks\NuGetCommand_333b11bd-d341-40d9-afcf-b32d5ce6f23b\2.155.0\CredentialProviderV2\plugins\netfx\CredentialProvider.Microsoft\CredentialProvider.Microsoft.exe'. A task was canceled.

Tried with NuGet 4.9.1 and 4.9.2 following NuGet/Home#7699, and also 5.1.0, all installedusing the NuGetToolInstaller task, but they all fail. Very occasionally one of the 6 failing jobs succeeds to restore, randomly, then fails again on next CI run. The other 4 jobs almost always succeed. All 10 jobs are running in parallel on different agents, and restoring one single prerelease package each from the same owner on nuget.org with no other source configured. This was working fine until yesterday 30th July although we had only 2 jobs instead of 10, although the issues started to manifest today 31st July even before I increased the number of jobs.

from artifacts-credprovider.

satbai avatar satbai commented on August 27, 2024

Hi @djee-ms
If the only package source is nuget.org, the credential provider shouldn't be launched. Could you try with NuGet 5.2? It looks like it's now available for download.

from artifacts-credprovider.

melcloud avatar melcloud commented on August 27, 2024

No, 5.2 doesn't work. It failed consistently for one of my pipelines. But others with same build template works fine. I have to use the fix in another github issue by adding two build variables:
NuGet.ForceEnableCredentialProvider: true and NuGet_ForceEnableCredentialProviderV2: false (lower case true and false)

Looks like v2 has some weird authentication errors. as the status code is 401.

It begins to work after I remove NuGet tool installer task, this means NuGet is back to the default version of 4.1.0

from artifacts-credprovider.

satbai avatar satbai commented on August 27, 2024

@djee-ms that's great!

@melcloud the most common reason for a 401 in the pipeline is that one of your PATs in your service connections is expired. Could you please verify that all of them are valid? This cred provider only works with NuGet 4.8 or higher, so version 4.1 will use the old authentication method.

from artifacts-credprovider.

Hawxy avatar Hawxy commented on August 27, 2024

This is still a problem with Nuget 5.3 in Azure pipelines. The restore fails in my project after ~50 seconds with the same error.

from artifacts-credprovider.

sakowiczm avatar sakowiczm commented on August 27, 2024

Experiencing the same problem on NuGet 5.3:

##[error]The nuget command failed with exit code(1) and error(Problem starting the plugin 
'd:\a\_tasks\NuGetCommand_333b11bd-d341-40d9-afcf-b32d5ce6f23b\2.158.0\CredentialProviderV2\plugins\netfx\CredentialProvider.Microsoft\CredentialProvider.Microsoft.exe'.
Plugin 'CredentialProvider.Microsoft' failed within 0.716 seconds with exit code -1.)
##[error]Packages failed to restore

from artifacts-credprovider.

igor-teresco avatar igor-teresco commented on August 27, 2024

For me adding -DisableParallelProcessing option to "nuget restore" command resolved this issue with latest nuget and CredProvider.

from artifacts-credprovider.

dgee2 avatar dgee2 commented on August 27, 2024

If anyone else hits this issue, I've had the same issue with one restore working and another failing in Azure DevOps using NuGet 5.3.1.
I had to add disableParallelProcessing to the restore step

from artifacts-credprovider.

pspill avatar pspill commented on August 27, 2024

This is an instance of NuGet/Home#8528

from artifacts-credprovider.

satbai avatar satbai commented on August 27, 2024

According to the discussion in the NuGet issue posted above, NuGet version 5.5.x should have all fixes related to this problem, and it looks like there is a preview version now available. Please update to nuget 5.5.x with the latest cred provider release 0.1.20.

from artifacts-credprovider.

BrianMouncer avatar BrianMouncer commented on August 27, 2024

According to the discussion in the NuGet issue posted above, NuGet version 5.5.x should have all fixes related to this problem, and it looks like there is a preview version now available. Please update to nuget 5.5.x with the latest cred provider release 0.1.20.

We are using nuget 5.8.1 and still hitting this issue with Azure feeds. about 1 in 5 builds will fail because auth and restore fail. Re-run the job, and it passes.

I'm going to try moving our CiCd pipeline to the latest version of nuget available, but I don't have confidence that will fix the reliability issue, since many posts on this thread expects this bug to be fixed before 5.8.1 that we are already using.

from artifacts-credprovider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.