rlidwka / sinopia

Private npm repository server
5.51k stars 656 forks source link

unable to publish to sinopia 413 #83

Open aikomastboom opened 10 years ago

aikomastboom commented 10 years ago

Upgrading our node stack the following came to light.

node 0.10.23 with npm 1.3.17. doing a npm publish works fine for us.

upgrading to node 0.10.24 or higher with npm 1.3.21 or higher results in the following error:

npm http PUT http://npm.adomain.net/a-package
npm http 413 http://npm.adomain.net/a-package
npm ERR! publish Failed PUT 413
npm ERR! Error: request entity too large : a-package
npm ERR!     at RegClient.<anonymous> (/var/lib/jenkins/.nave/installed/0.10.24/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:275:14)
npm ERR!     at Request.self.callback (/var/lib/jenkins/.nave/installed/0.10.24/lib/node_modules/npm/node_modules/request/request.js:123:22)
npm ERR!     at Request.EventEmitter.emit (events.js:98:17)
npm ERR!     at Request.<anonymous> (/var/lib/jenkins/.nave/installed/0.10.24/lib/node_modules/npm/node_modules/request/request.js:893:14)
npm ERR!     at Request.EventEmitter.emit (events.js:117:20)
npm ERR!     at IncomingMessage.<anonymous> (/var/lib/jenkins/.nave/installed/0.10.24/lib/node_modules/npm/node_modules/request/request.js:844:12)
npm ERR!     at IncomingMessage.EventEmitter.emit (events.js:117:20)
npm ERR!     at _stream_readable.js:920:16
npm ERR!     at process._tickCallback (node.js:415:13)
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21

on the sinopia side we see:

http  <-- 413, user: jenkins, req: 'PUT /a-package', error: request entity too large

a 0.10.23 publish looks like this:

http  <-- 409, user: jenkins, req: 'PUT /a-package', error: this package is already present
http  --> 404, req: 'GET https://registry.npmjs.org/a-package', bytes: 0/52
http  <-- 200, user: jenkins, req: 'GET /a-package', bytes: 0/2393441
http  <-- 201, user: jenkins, req: 'PUT /a-package/-/a-package-1.0.1-678.tgz/-rev/1341-a9d2ab1f359ff904', bytes: 17905144/43
http  <-- 201, user: jenkins, req: 'PUT /a-package/1.0.1-678/-tag/latest', bytes: 6737/31

note: This particular a-package is about 17Mb in size. note 2: With node 0.10.23 we have no trouble publishing packages 250Mb in size.

rlidwka commented 10 years ago

Please change your config to allow larger packages:

# maximum size of uploaded json document
# increase it if you have "request entity too large" errors
max_body_size: 10mb

The default is 10mb, and this limitation is done mostly for security reasons, because dealing with large packages is very memory-consuming. 17Mb won't be an issue, but 250Mb with newer npm versions can crash some systems.

razbensimon commented 8 years ago

Worked for me! Thanks

hvpulok commented 6 years ago

Worked for me as well