-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Providers are unreliable #370
Comments
Thanks for raising the issue. Is there a way to reliably repro this? |
I don't know whether this provides any assistance, but FWIW, I'm finding that the libman restore command works reliably with cdnjs, but referencing the provider unpkg (which works within the IDE), consistently fails via the restore command, the reported errors are: I've attached my libman.json file: |
I've ran into similar feedback messages from Libman a while ago when I tried to deploy an app that used it. I haven't looked into it at all, but at the time, if I rebuilt the solution first, then tried the deploy again it seemed to work (implying maybe one has caching issues)? I can't provide much more detail than that in my instance. |
I have a similar behavior. You add your package in via cdnjs (because unpkg almost never works, in fact I've never personally got it it to work). Some packages you select will come down, but others fail consistently. For instance, try to add the monaco-editor and it will consistently returns 404 for half of the files. I'm starting to think it's a CDN problem all together. Example: Failed to download resource from "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.15.6/min-maps/vs/loader.js.map" However, if I navigate to that URL manually and it worked. But then I did it again and it 404'd. I reloaded that exact 404 and it worked. I opened up the Chrome utilities and reloaded every few seconds and about 20% of the requests returned a 200 with the file, the rest 404'd with the same URL. This is the behavior seen when trying to restore packages with a fair amount of files. -Something- fails and then the whole thing fails. The more files there are, the more chance something 404's and it can be different every time which is making it impossible to restore some packages via this mechanism. I haven't used this a ton but I've observed it over a serious of a few weeks. |
As of recent this problem became worse Are there any plans to implement a fallback mechanism? Thank you. |
I've just been downloading libraries with npm and adding filesystem
references to files in node_modules.
…On Mon, Dec 24, 2018, 11:04 freemstr ***@***.*** wrote:
As of recent this problem became worse
Error LIB010 Failed to download resource from "
https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.0/js/npm.js"
The 404 response from cdnjs is intermittent but it fails the build and
costs man-hours in reaction to failed build notifications and followup
email notification about the build notifications
Are there any plans to implement a fallback mechanism?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#370 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGE0TkhVrJkc3kDmJydRdOfn6vuA-QS-ks5u8PsQgaJpZM4WbUgN>
.
|
@justcla Could this be related? |
I think this would be useful. |
Here the same problems. But also when it is in production that unpkg.com is sometimes very slow and unreachable. For builds this is a lesser issue locally, because we can retry this, but when having CI it will fail the builds. In production it could take 30 seconds to load the page.. Something is wrong with unpkg, you should expect CloudFlare to keep it stable. |
Maybe the same bug here. Sometimes the packages can be restored, sometimes they cannot be resolved by "unpkg". I've read that unpkg is way better than cdnjs because of its architecture. While unpkg makes npmjs packages accessible, cdnjs is barely manageable anymore these days. If unpkg is just as bad, there are no more options and I'm keeping a copy of the JavaScript files in my Git repository again, just like in the past. It's not that they are too big for that. At least they're there where my code is, and not gone half of the time. Also, why does LibMan have to restore these files from online at every build? The files are there, there's no reason to fail the build because they couldn't be downloaded. That's just stupid. |
And strangely, ASPNETCDN is not one of the listed package providers. You'd think Microsoft have an option to use its own CDN. |
@justcla I can frequently repro this when trying to restore |
The LIB002 is most likely due to GET requests going via HTTP protocol - in such cases unpkg returns status code 301. That's the behaviour we're seeing as per #491 LIB018 seems to be present in larger packages - the meta related to it becomes truncated as confirmed with Fiddler. Are there any timeouts in play within Libman to prevent hangs during the restore process. It could also be race conditions. If unpkg takes more than 30s to return the full package payload does Libman simply kill the request and throw? |
Oh, maybe it has to fetch on every build because of #490. It doesn't know what it's doing or what it has done. So it has to check every time. And it even fails either way. Can't detect new files and can't download anything, then blows up either the build or the application at runtime. It's on my list of things to throw out the window now. |
We routinely see 'The ... library could not be resolved by the "unpkg" provider' errors. It causes continuous builds to fail. It causes local builds to fail. It's pretty much a fail. I don't understand why the team opted to move to a library manager that supports fewer packages and is less reliable. Very frustrating. |
Also running into the same error (also unpkg) and it's preventing production builds intermittently. |
I am having the same issue as hempels (Visual studio Community 2019 16.3.6). It would be great if this was solved as for my project Libman seems to be a generally good option. |
I got fed up with it. All of the packages I used unpkg for originally are now obtainable from jsDelivr, I believe it was added after unpkg. So now I'm just using jsDelivr instead. Still using libman mind you, I just no longer using unpkg as a package source. |
@nickalbrecht jsDelivr is not available in the selection. How did you do that? |
@ygoe Just update Library Manager to the most recent version, it was added at a later date so earlier version won't have it. |
Tried with VS 2017. Not switched to VS 2019 yet. Waiting for a usable version (without several blocking bugs) with .NET Core 3 support (which should be 16.4). |
You should also be able to use the CLI or the Build package if you don't have VS2019. I use Microsoft.Web.LibraryManager.Build so that my libraries restore as part of the build outside of VS. But we're kind of getting off topic :-P |
All my install library are failing to restore when i run restore client side library for my libma.js file. I am recieving this error " library could not be resolved by the "cdnjs" provider" |
Correct, around 8 hours ago this started happening. It is because of problems at cdnjs / Cloudflare. Looks like it should is resolved almost an hour ago: |
Issues solved. The package restore is working fine again. |
I had a similar issue. The problem was with package name.
I was using
The message was confusing. And it wasn't installing any of my packages. The message should be something like |
@denis-pujdak-adm-it If I were to rephrase your point, we should be emphasizing that the library name couldn't be found separately from the name@version? E.g. |
@jimmylewis Hm. Anyway. That was just my thought based on my experience with the instalation. |
@jimmylewis I may have just assumed there were no retries because I didn't see any messages about them, just the final failure. When I first encountered these reliability issues, I set up a test project with a dependency on AdminBSB. I forget which providers offer that package. AdminBSB contains a huge number of files, thousands IIRC, and is never successfully restored. |
This continues to be very frustrating. |
I had an error from an AzureDevOps job the other day from this. Basically had to re-queue the job a handful of times until it finally solved itself. Not sure if it finally went through because of the job getting assigned to a different machine that didn't have caching issues or what though. |
I wonder if I can customize the mirror source like Nuget, which is too reliant on the cloud, and I think my hard disk is more reliable than the cloud.Libman is a good tool, but CDN isn't |
To any mortal soul in eternal torture by this shockingly unfixed bug, here's a workaround:
<!-- Workaround https://github.com/aspnet/LibraryManager/issues/370 -->
<Target Name="RestoreFrontEndLibraries" BeforeTargets="BeforeBuild">
<Exec Command="dotnet tool restore" />
<Exec Command="dotnet tool run libman restore" LogStandardErrorAsError="true" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Exec Command="dotnet tool run libman restore" LogStandardErrorAsError="true" ContinueOnError="true" Condition="$(ErrorCode) != '0'">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Exec Command="dotnet tool run libman restore" LogStandardErrorAsError="true" ContinueOnError="true" Condition="$(ErrorCode) != '0'">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Exec Command="dotnet tool run libman restore" LogStandardErrorAsError="true" ContinueOnError="true" Condition="$(ErrorCode) != '0'">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Exec Command="dotnet tool run libman restore" LogStandardErrorAsError="true" ContinueOnError="true" Condition="$(ErrorCode) != '0'">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Exec Command="dotnet tool run libman restore" LogStandardErrorAsError="true" ContinueOnError="true" Condition="$(ErrorCode) != '0'">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Exec Command="dotnet tool run libman restore" LogStandardErrorAsError="true" ContinueOnError="true" Condition="$(ErrorCode) != '0'">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Exec Command="dotnet tool run libman restore" LogStandardErrorAsError="true" ContinueOnError="true" Condition="$(ErrorCode) != '0'">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Exec Command="dotnet tool run libman restore" LogStandardErrorAsError="true" ContinueOnError="true" Condition="$(ErrorCode) != '0'">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Exec Command="dotnet tool run libman restore" LogStandardErrorAsError="true" ContinueOnError="false" Condition="$(ErrorCode) != '0'" />
</Target> This code retries up to 10 times, you can copy / paste one of the middle |
I don't think it can solve the problem that cdnjs cannot connect |
It doesn't solve the problem of connect failure, but it just does retry, it works after some times. Better than build server random failure due to this issue. |
I think it is more important for subsequent versions to customize the mirror source like Nuget. Now everything is built on the damn cloud |
It won't help you one bit if the CDN providers rate-limit you because your build server is fetching from their servers too often. Its hardly a responsible practice either, if you're building using this service, then commit your libraries or the relevant files. |
Typically when this happens for me, LibMan may claim it can't be reached, but if I navigate to the URL manually in a browser it will come up. I'm more inclined to believe it's an inconsistent behavior with the caching in LibMan versus the CDN refusing to fulfill the request. Every time that I can remember navigating to the URL manually, the resource was found. |
Perhaps if libman reported the http status code it might be a little more obvious, if it is rate-limited rather than generally failed to fetch the data. I don't think the caching is at fault, as libman will be attempting to fetch something (that 'metadata') from the CDN to determine if its cache is up-to-date. Stick wireshark on, and see for yourself what happens in the meantime. |
Add caching for provider metadata This affects the scenarios where we need to fetch the latest library versions or the file lists for a given library. For Cdnjs, because they offer a full catalog, it also affects that. When fetching versions (or catalog), we want to have live data if possible, as new versions (or packages) can be released. These operations will initially attempt a web request, and if it fails, fall back to the cached contents on disk (if any). Note that there is now a 1-day cache lifetime applied to the initial request, which should cut down on repetitive traffic. When fetching file lists, we assume that released libraries are static. In this case, we first check for the information on disk, and then fallback to a web request if it's missing. There is no lifetime applied in this case. If the library is mutated, a user will have to clear the cache to get the updated metadata for the library (but, they'd have to do the same to get updated versions of any cached library assets as well). This resolves #598, which should in turn help with some of the reliability issues reported in #370.
Today on my computer, I have So I download and debug Libman source code, in my case, it is caused by an exception when trying to parse JSON.
The requested URL was The json string has an invalid ending: I request the URL from Microsoft Edge browser and use notepad++ to view the JSON and found the same thing But when using Google Chrome to request the JSON, to my surprise, it is fine: I RDP into my build server, request the same JSON from Microsoft Edge, it is also fine. So I guess it may be a network issue or CDN issue that give me a bad json. I try to switch to a different network using a VPN, but libman still fails. After debug, I found it is caching the old bad json. The cached file is located in After clean up the local cache, everything works fine. So I would suggest libman DO NOT cache bad json file when having an exception during the installation. |
That suggests its not Libman at fault at all but the networking subsystem, which is not surprising as all Windows http stack is built on the same internet management stuff. So once you have a malformed download, it sticks in the browser cache (that libman is leveraging). The cache will contain this json as it will have assumed a correct download - I doubt any http get will cache a failed request! So now you're looking at the duration these items stay in the cache for. The only thing Libman can do in this situation is to give a better error message that the file is corrupt. If it can (and this is doubtful) remove it from the cache so it gets refreshed, so much the better. |
That's still Libman's fault, just in a different way. If the system cache doesn't work the way Libman needs it to work, Libman shouldn't be using the system cache. |
To clear the cache, we can either manually delete dotnet tool install -g Microsoft.Web.LibraryManager.Cli then libman cache clean |
https://api.cdnjs.com/libraries/ace is now broken. (the CDN version, not my local cache.) |
A year passed the providers are still very unreliable: It randomly fails the CI and we can do nothing but to speed up plans to migrate away from Libman as soon as possible. |
The issue is still happening:
Running |
One of the actions that helped me solve this problem was updating project packages with stable releases. Some of my packages were running in depreciated version. |
Functional impact
Builds fail because required lib files don't exist in project.
Minimal repro steps
Expected result
Files that restore successfully once should always restore successfully
Actual result
LibMan intermittently fails with error LIB002 or LIB018, or doesn't load the correct contents of the package (i.e., index.html instead of dist/**).
The text was updated successfully, but these errors were encountered: