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

Uplink timeouts/connectivity issues reported as "no such package available" #720

Closed
edmorley opened this issue May 29, 2018 · 6 comments
Closed
Assignees
Projects
Milestone

Comments

@edmorley
Copy link

edmorley commented May 29, 2018

Describe the bug
If the uplink request to a registry fails with a connectivity error such as socket hang up or ETIMEDOUT, the response to the client is an HTTP 404 which makes it give a misleading error message about the package not existing.

The yarn client reports:

error Couldn't find package "align-text@^0.1.3" required by "center-align@^0.1.1" on the "npm" registry.
...
Error: Couldn't find package "har-schema@^2.0.0" required by "har-validator@~5.0.3" on the "npm" registry.
    at MessageError.ExtendableBuiltin (/home/travis/.yarn/lib/cli.js:243:66)
    at new MessageError (/home/travis/.yarn/lib/cli.js:272:123)
    at PackageRequest.<anonymous> (/home/travis/.yarn/lib/cli.js:36403:17)
    at Generator.throw (<anonymous>)
    at step (/home/travis/.yarn/lib/cli.js:98:30)
    at /home/travis/.yarn/lib/cli.js:111:13
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
...

However the Verdaccio logs show the real cause:

 info <-- 127.0.0.1 requested 'GET /har-schema'
 info --> making request: 'GET https://registry.yarnpkg.com/har-schema'
...
 info <-- 127.0.0.1 requested 'GET /align-text'
 info --> making request: 'GET https://registry.yarnpkg.com/align-text'
...
 http --> ERR, req: 'GET https://registry.yarnpkg.com/har-schema', error: socket hang up
 http <-- 404, user: undefined(127.0.0.1), req: 'GET /har-schema', error: no such package available
...
 http --> ERR, req: 'GET https://registry.yarnpkg.com/align-text', error: ETIMEDOUT
 http <-- 404, user: undefined(127.0.0.1), req: 'GET /align-text', error: no such package available

To Reproduce
Steps to reproduce the behavior:

  1. Open a PR against master of https://travis-ci.org/mozilla-neutrino/neutrino-dev thereby triggering the TravisCI run
  2. Retrigger the TravisCI job until it fails due to their current connectivity flakiness
  3. Look at the Verdaccio logs

Expected behavior

  • (ideally, but not the primary issue here) the initial request to the registry should be retried
  • if the retry fails, Verdaccio should reply with an HTTP 504 ("Gateway timeout") or some other HTTP status code that would let the yarn client show the correct error message

Configuration File (cat ~/.config/verdaccio/config.yaml)

store:
  memory:
    limit: 10000
uplinks:
  yarnpkg:
    url: https://registry.yarnpkg.com/
    timeout: 20s
    max_fails: 5
packages:
  'neutrino':
    access: $anonymous
    publish: $anonymous
  '@neutrinojs/*':
    access: $anonymous
    publish: $anonymous
  '**':
    access: $anonymous
    proxy: yarnpkg
logs:
  - {type: stdout, format: pretty, level: debug}

Debugging output
https://travis-ci.org/mozilla-neutrino/neutrino-dev/jobs/385364189#L989

Additional context
This issue also occurred when using the npmjs.org registry instead of Yarn's.

@juanpicado
Copy link
Member

I will check it our next week, now I am focused in v3 release 🙃. Unless someone around here wants to dive into it.

@jharris4
Copy link
Contributor

jharris4 commented May 30, 2018

I'm having all sorts of issues like this all of a sudden:

{"name":"verdaccio","hostname":"verdaccio1","pid":28733,
"sub":"in","level":35,"request":{"method":"GET","url":"/lerna"},
"user":"jharris","remoteIP":"192.168.124.5 via 192.168.11.31",
"status":404,"error":"File not found",
"bytes":{"in":0,"out":32},"msg":"@{status}, user: @{user}
(@{remoteIP}), req: '@{request.method} @{request.url}', error: @{!error}",
"time":"2018-05-30T22:12:21.389Z","v":0}

It's changing every time I run yarn install, and I think it might be the same issue as this one...

@jharris4
Copy link
Contributor

So, strangely enough I'm not getting these errors any more after I re-installed our verdaccio server but with root ownership of /usr/lib/node_modules (linux).

@edmorley
Copy link
Author

I think NPM have made further changes post Cloudflare migration, since the errors I was seeing on Travis (even on GCE) have now stopped with no changes on my part.

@edmorley
Copy link
Author

Hi! We're seeing this quite a lot again the last week or two on TravisCI.

Whilst the underlying issue (network connectivity problems/...) aren't Verdaccio's fault - it would be good for Verdaccio to report the real error and/or handle this case better.

mlazowik added a commit to mlazowik/create-react-app that referenced this issue Sep 19, 2018
Should help with `Couldn't find package` errors, see
verdaccio/verdaccio#720
@juanpicado juanpicado added this to the 4.0.0 milestone Oct 10, 2018
@juanpicado juanpicado self-assigned this Oct 10, 2018
@juanpicado juanpicado added this to In Progress in Verdaccio 4 Oct 10, 2018
@juanpicado juanpicado moved this from In Progress to Pick Up in Verdaccio 4 Nov 23, 2018
@juanpicado juanpicado moved this from Pick Up to (Under consideration) in Verdaccio 4 Nov 30, 2018
@ayusharma ayusharma self-assigned this Feb 12, 2019
@juanpicado juanpicado modified the milestones: 4.0.0, 4.1.0 Feb 26, 2019
juanpicado pushed a commit that referenced this issue Jun 13, 2019
fix  #1328 and #720

Type: bug

The following has been addressed in the PR:

Instead of returning a 404 (Not Found) when npm, yarn, etc requests a package and the package cannot be acquired from an uplink due to a connection timeout, socket timeout, or connection reset problem, a 503 (service unavailable) is returned by Verdaccio instead. In limited testing of a few versions of npm and yarn, both of these clients correctly attempt to retry the request when a 503 is returned.

Added functional tests to verify the behavior (this adds a dev dependency on nock, which provides HTTP request mocking

Description:

This resolves issue #1328 and #720, and ensures npm/yarn install commands don't fail immediately when there is an intermittent network timeout problem with an uplink. Instead Verdaccio will appropriately respond to the client with a 503. A 404 response (current behavior) incorrectly tells the client that the package does not exist (which may or may not be true) and to not try again.
@juanpicado juanpicado modified the milestones: 4.1.0, 4.x.x Jun 13, 2019
@lock
Copy link

lock bot commented Sep 11, 2019

🤖This thread has been automatically locked 🔒 since there has not been any recent activity after it was closed.
We lock tickets after 90 days with the idea to encourage you to open a ticket with new fresh data and to provide you better feedback 🤝and better visibility 👀.
If you consider, you can attach this ticket 📨 to the new one as a reference for better context.
Thanks for being a part of the Verdaccio community! 💘

@lock lock bot added the outdated label Sep 11, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Verdaccio 4
  
(Under consideration)
Development

No branches or pull requests

4 participants