npmjs icon indicating copy to clipboard operation
npmjs copied to clipboard

ETIMEDOUT

Open gcollazo opened this issue 10 years ago • 4 comments

Hey, first of all great module, thanks.

I've been encountering a problem while doing a npm.packages.get for a list of about 400 modules. A few hundred come back without problem but a few of them get a 500 status code with error message ETIMEDOUT.

Any ideas on how to get around this?

gcollazo avatar Jan 07 '15 21:01 gcollazo

Hard to say without knowing where the ETIMEDOUT comes from.

3rd-Eden avatar Jan 07 '15 21:01 3rd-Eden

It only happens when I do a batch of 400 or more consecutive npm.packages.get. I think it might be a throttling feature on the registry.

Here's one of the errors:

{ [Error: ETIMEDOUT]
  code: 'ETIMEDOUT',
  url: 'http://registry.nodejitsu.com/with-style-mixin',
  statusCode: 500,
  errors: [],
  body: undefined,
  data: {},
  remaining: 0,
  ratereset: 0,
  ratelimit: 0 }

Another thing to have in mind is that if I just do a single npm.packages.get('with-style-mixin', ....) it works.

I was hoping you've encountered this before and have a technique to go around the issue. I see you have some options to setup exponential back off but I think is for retrying to connect when the registry is down.

gcollazo avatar Jan 07 '15 22:01 gcollazo

@gcollazo ideally, it should fallback to other repositories when we receive a 500 message to see if they are up to speed.

3rd-Eden avatar Jan 08 '15 07:01 3rd-Eden

I figured it out! The gzip option isn't being used to set the accepting encoding of the request header. That causes the larger requests to time out (they even time out in curl). Passing that option through to mana (which passes it to request) causes bigger requests to succeed.

mrjoelkemp avatar Oct 26 '15 03:10 mrjoelkemp