If the resource is not found, the stream will emit an error anyway, so, we should not open the stream if we know the resource is not there, in such case we wait the stream fails and verdaccio takes the control of the error and fetch the tarball, otherwise, we doom the user to get 404.
Type: bug
Description:
This is an issue I solved on Google Cloud Plugin where if we open the stream verdaccio won't try to get it from upstream As a reference https://github.com/verdaccio/verdaccio-google-cloud/blob/master/src/storage.js#L308
If the resource is not found, the stream will emit an error anyway, so, we should not open the stream if we know the resource is not there, in such case we wait the stream fails and verdaccio takes the control of the error and fetch the tarball, otherwise, we doom the user to get 404.
Here is were the error event is emitted. https://github.com/aws/aws-sdk-js/blob/fe88308a8699b39aef06492c898b265a3a24251f/lib/request.js#L38