Skip to content
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

BUG: error An unexpected error occurred: Request failed 404 Not Found. #3530

Open
droslean opened this issue Dec 17, 2022 · 23 comments
Open

Comments

@droslean
Copy link

Version: 5.15.4

This happened when we are trying to change the version of a specific package. Our older package is already cached, and when verdaccio tries to get the tarball from the cache it gets 404 because of the version change.

The solution is to manually delete the folder of the package from the cache and try again. That means that Verdaccio can't support multiple versions in the cache. This is a big blocker.

Config:

storage: /verdaccio/storage/data
plugins: /verdaccio/plugins
web:
  enable: true
  title: Verdaccio
url_prefix: '/'
uplinks:
  npmjs:
    url: https://registry.npmjs.org/
    cache: true
    maxage: 259200m
  yarnpkg:
    url: https://registry.yarnpkg.com/
    cache: true
    maxage: 259200m
packages:
  '@*/*':
    access: $all
    publish: $authenticated
    proxy: yarnpkg npmjs
  '**':
    access: $all
    publish: $authenticated
    proxy: yarnpkg npmjs
middlewares:
  audit:
    enabled: true
logs:
  - {type: stdout, format: pretty, level: debug}

To support multiple version, do we have to enable this somehow in the configuration?

@gregpavl
Copy link

cc @juanpicado

@juanpicado
Copy link
Member

juanpicado commented Dec 20, 2022

Our older package is already cached, and when verdaccio tries to get the tarball from the cache it gets 404 because of the version change. The solution is to manually delete the folder of the package from the cache and try again. That means that Verdaccio can't support multiple versions in the cache. This is a big blocker.

You might need to define specific steps with a vanilla npmjs installation that I can follow to reproduce because at first glance I cannot know if this is a bug on verdaccio or not. Also try out the latest and the version you are using, please.

To support multiple version,

Could you elaborate on what actually means multiple version? 🤔

@droslean
Copy link
Author

Our older package is already cached, and when verdaccio tries to get the tarball from the cache it gets 404 because of the version change. The solution is to manually delete the folder of the package from the cache and try again. That means that Verdaccio can't support multiple versions in the cache. This is a big blocker.

You might need to define specific steps with a vanilla npmjs installation that I can follow to reproduce because at first glance I cannot know if this is a bug on verdaccio or not. Also try out the latest and the version you are using, please.

To support multiple version,

Could you elaborate on what actually means multiple version? thinking

The BUG is that verdaccio can't resolve the package because its missing from the cache. At first, verdaccio is creating a folder in the cache and download the package, but if the folder already exists and the requested package is a different version that the cache holds, then it returns 404. This is 100% a BUG.

@juanpicado
Copy link
Member

Thanks, I will try to reproduce it locally and if I confirm might be fixed on the next patch.

@droslean
Copy link
Author

@juanpicado Friendly reminder... Any updates?

@juanpicado
Copy link
Member

On holidays mode :) will back soon few days

@gregpavl
Copy link

is there any update on this issue @juanpicado

@droslean
Copy link
Author

droslean commented Mar 1, 2023

@juanpicado Any news? My team is planning to stop using Verdaccio because of this issue. Please share a solution if there is any.

@juanpicado
Copy link
Member

juanpicado commented Mar 8, 2023

Nop, things takes time but eventually are done, be patience and be aware I am not having much help (so if someone wants to contribute to speed up I´m happy to review fast). Whenever I have an update I always post on tickets, if I don´t well, there is no much to say 🙃

@juanpicado juanpicado added this to the 5.x milestone Mar 11, 2023
@droslean
Copy link
Author

droslean commented Apr 17, 2023

@juanpicado Same problem with 5.23.2 version.

Error:

error An unexpected error occurred: "http://verdaccio.verdaccio:4873/@types/node/-/node-16.18.23.tgz: Request failed \"404 Not Found\"".

Here is my cache:

/verdaccio/storage/data/@types/node $ ls -lrt
total 11428
-rw-rw-r--    1 verdacci 101         630898 Mar 20 07:41 node-16.18.14.tgz
-rw-rw-r--    1 verdacci 101         667592 Mar 20 07:41 node-18.15.1.tgz
-rw-rw-r--    1 verdacci 101         630145 Apr  1 19:15 node-16.18.3.tgz
-rw-rw-r--    1 verdacci 101         655933 Apr  1 19:15 node-18.11.9.tgz
-rw-rw-r--    1 verdacci 101        9106420 Apr  1 19:15 package.json

As you can see the node-16.18.23 is not in the cache as it shouldn't be since we never used it. Verdaccio should have tried to download that node version too, but instead, it is falling. This is 100% a BUG in verdaccio.

I am guessing that verdaccio finds the node folder in the cache, and it is not trying to download anything because it thinks that the requested package already exists in the cache.

@droslean droslean changed the title error An unexpected error occurred: Request failed 404 Not Found. BUG: error An unexpected error occurred: Request failed 404 Not Found. Apr 17, 2023
@droslean
Copy link
Author

@juanpicado Can you prioritize this issue, since its a critical BUG and a big blocker for us and I assume for many others that are using the verdaccio as cache too?

@juanpicado
Copy link
Member

Why you have maxage: 259200m so high? Anyhow with such value so high verdaccio will hardly try to fetch any update from upstreams.

In any case, I cannot reproduce locally with a simple npm installation, I see you insist this is a BUG, if that the case, please provide reproducible steps, simple ones, because I can't myself with the info provided.

@droslean
Copy link
Author

@juanpicado You can check #3530 (comment). Reproducing it is simple, let the cache download a specific version of a package, and then try again with a different version of the same package. You will get 404. Do you think that this is caused by maxage: 259200m ?

@juanpicado
Copy link
Member

I don't recommend such high value, package managers also have it own cache system. Why would you need 180 days ? I think invalid cache every week is more than enough, try out.

Regarding the steps I followed them and I can't, happy to fix it but due my limited time I need the exact steps otherwise the time for fox the bug is invested only in debugging.

@droslean
Copy link
Author

Ok! Let me try this out and see if the problem persists! I will keep you updated. Thanks.

@droslean
Copy link
Author

@juanpicado Do you have any recommended value? Also, how the cache is being invalidated, and after how many days? For the record our package manager doesn't have any cache.

@juanpicado
Copy link
Member

juanpicado commented Apr 18, 2023

On CI yes, pkg manager cache is useless since is discarded (not always in Jenkins you can save it between builds in the same branch). But local does not, so for reproduce mode is something to keep on mind. What value ? Well depends, the tarballs are not invalidated only the metadata (package.Json file) and the value might vary based in your our own needs, how often your devs upgrade? Do you use automation dep managers (renovate)? If is too low you pay a penalty of performance if is to high you get into 404 because verdaccio won't download new metadata upgrades (this might be your error). Npm has 2 min by default, but for CI is to low, so 1 day or 4 days (7 is ok because weekends usually no builds happening) too would be enough to don't get 404 but might happens for such gap of time. You need to do your own math.

@droslean
Copy link
Author

@juanpicado Same problem with maxage: 14400m. Any other insights?

@droslean
Copy link
Author

droslean commented Jul 3, 2023

@juanpicado Any updates?

@droslean
Copy link
Author

droslean commented Jul 3, 2023

Another example of the problem's replication:

/verdaccio/storage/data/@types/node $ ls -lrt
total 12692
-rw-r--r--    1 verdacci node        701331 Jun 30 10:04 node-20.3.2.tgz
-rw-r--r--    1 verdacci node        634774 Jun 30 10:05 node-16.18.37.tgz
-rw-r--r--    1 verdacci node        667592 Jun 30 10:06 node-18.15.1.tgz
-rw-r--r--    1 verdacci node        631992 Jun 30 10:06 node-16.18.23.tgz
-rw-r--r--    1 verdacci node        677014 Jun 30 10:09 node-18.16.18.tgz
-rw-r--r--    1 verdacci node       9673282 Jun 30 10:09 package.json

But when we are trying to get the node-20.3.3.tgz we get 404 from Verdaccio.

error An unexpected error occurred: "http://verdaccio.verdaccio:4873/@types/node/-/node-20.3.3.tgz: Request failed \"404 Not Found\"".

This looks like a BUG from Verdaccio side, since the only solution for us is to delete the cache and force verdaccio to re-download the packages. For some reason, Verdaccio sees that the @types folder already exists and doesn't download anything.

@tomer555
Copy link

we are getting the same problem? is there a fix for that?

@droslean
Copy link
Author

@tomer555 I haven't found any solution. I guess @juanpicado should have to take a look as this looks like a bug in verdaccio.

@juanpicado juanpicado modified the milestones: 5.x, 6.x Aug 20, 2023
@lct-copilot-6
Copy link

got the same problem, looking forward to updates

verdaccio version: 5.29.0
node: v20.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants