verdaccio: 500 Internal Server Error - unknown error on only some packages
Describe the bug
I get the 500 Internal Server Error - GET http://<my_registry>:4873/husky - unknown error on multiple packages like husky or jest. Other packages just work fine …
When i open the URL, verdaccio shows:
{
"error": "unknown error"
}
When i run npm-check-updates (on the client) the following error is shown:
{
headers: [Object: null prototype] {
'x-powered-by': [ 'verdaccio/4.6.2' ],
'access-control-allow-origin': [ '*' ],
'content-type': [ 'application/json; charset=utf-8' ],
'content-length': [ '31' ],
vary: [ 'Accept-Encoding' ],
date: [ 'Mon, 18 May 2020 10:33:41 GMT' ],
connection: [ 'keep-alive' ],
'x-fetch-attempts': [ '1' ]
},
statusCode: 500,
code: 'E500',
method: 'GET',
uri: 'http://<my_registry>:4873/husky',
body: { error: 'unknown error' },
pkgid: 'husky@latest',
message: '500 Internal Server Error - GET http://<my_registry>:4873/husky - unknown error'
}
To Reproduce I don’t really know - i have a pretty default Verdaccio installation and the error hasn’t occured when i installed it. I occurs when i try to update e.g. husky or jest some other packages seem to work just fine.
Expected behavior
Don’t show the unknown error and just get the current data from the npm registry.
Configuration File (cat ~/.config/verdaccio/config.yaml)
Pretty standard / default:
# path to a directory with all packages
storage: /<my_nas>/srv/npm
# path to a directory with plugins to include
plugins: ./plugins
web:
enable: true
title: Verdaccio
# comment out to disable gravatar support
# gravatar: false
# by default packages are ordercer ascendant (asc|desc)
# sort_packages: asc
auth:
htpasswd:
file: ./htpasswd
# Maximum amount of users allowed to register, defaults to "+inf".
# You can set this to -1 to disable registration.
# max_users: 1000
security:
api:
jwt:
sign:
expiresIn: 60d
notBefore: 1
web:
sign:
expiresIn: 7d
notBefore: 1
# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
packages:
'@*/*':
# scoped packages
access: $all
publish: $authenticated
unpublish: $authenticated
proxy: npmjs
'**':
# allow all users (including non-authenticated users) to read and
# publish all packages
#
# you can specify usernames/groupnames (depending on your auth plugin)
# and three keywords: "$all", "$anonymous", "$authenticated"
access: $all
# allow all known users to publish/publish packages
# (anyone can register by default, remember?)
publish: $authenticated
unpublish: $authenticated
# if package is not available locally, proxy requests to 'npmjs' registry
proxy: npmjs
# You can specify HTTP/1.1 server keep alive timeout in seconds for incomming connections.
# A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout.
# WORKAROUND: Through given configuration you can workaround following issue https://github.com/verdaccio/verdaccio/issues/301. Set to 0 in case 60 is not enought.
server:
keepAliveTimeout: 60
middlewares:
audit:
enabled: true
# log settings
logs:
- { type: stdout, format: pretty, level: http }
#- {type: file, path: verdaccio.log, level: info}
listen: 0.0.0.0:4873
Environment information
System: OS: Linux 3.4 Debian GNU/Linux 10 (buster) 10 (buster) CPU: (4) arm ARMv7 Processor rev 5 (v7l) Binaries: Node: 13.14.0 - /usr/bin/node npm: 6.14.5 - /usr/bin/npm npmGlobalPackages: verdaccio: 4.6.2
Debugging output
$ NODE_DEBUG=request verdaccioprints:
error-=- error reading package.json: Unexpected token : in JSON at position 216935
http <-- 500, user: cmiksche(<my_client>), req: 'GET /husky', error: unknown error
http <-- 500, user: cmiksche(<my_client>), req: 'GET /husky', error: unknown error
error-=- error reading package.json: Unexpected token in JSON at position 57852
http <-- 500, user: cmiksche(<my_client>), req: 'GET /jest', error: unknown error
http <-- 500, user: cmiksche(<my_client>), req: 'GET /jest', error: unknown error
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (5 by maintainers)
才看到, 可能你已经解决了,毕竟这么长时间。。。我还是回复下吧 我记得但是因为linux目录权限问题
Seems your cache is corrupted, i would remove the packages are throwing error and try again
The problem was solved, It’s a linux authorization problem
Our verdaccio server is working with 3 different upstreams and we also experience this problem from time to time. Deleting the affected package and retrying helps but I agree that it would help if cache corruptions like this could be detected and healed automatially
@juanpicado we only ever run a single verdaccio pod in our cluster.
Edit: with regards to logs, we currently seeing
error: uplink is offlinebut we can easily access npm from the same pod using curl.Edit 2: And it’s with the following tweaks suggested either in this issue, or elsewhere: