Intermittent "Error: socket hang up" errors

We’re using Nuxt to statically build our Vue app. We are using Contentful as our CMS. We build around 700 pages, each of which triggers a handful of calls to the Contentful API through their SDK. We are using Nuxt’s interval setting to limit the number of simultaneous requests; it’s been set to 400.

We intermittently see Error: socket hang up error messages like this:

8:11:43 PM:   Error: socket hang up
8:11:43 PM:   
8:11:43 PM:   - _tls_wrap.js:1148 TLSSocket.onHangUp
8:11:43 PM:     _tls_wrap.js:1148:19
8:11:43 PM:   
8:11:43 PM:   - events.js:313 Object.onceWrapper
8:11:43 PM:     events.js:313:30
8:11:43 PM:   
8:11:43 PM:   - events.js:111 emitNone
8:11:43 PM:     events.js:111:20
8:11:43 PM:   
8:11:43 PM:   - events.js:208 TLSSocket.emit
8:11:43 PM:     events.js:208:7
8:11:43 PM:   
8:11:43 PM:   - _stream_readable.js:1064 endReadableNT
8:11:43 PM:     _stream_readable.js:1064:12
8:11:43 PM:   
8:11:43 PM:   - next_tick.js:139 _combinedTickCallback
8:11:43 PM:     internal/process/next_tick.js:139:11
8:11:43 PM:   
8:11:43 PM:   - next_tick.js:219 process._tickDomainCallback
8:11:43 PM:     internal/process/next_tick.js:219:9
8:11:43 PM:   
8:11:43 PM: 
8:11:43 PM: Error: socket hang up
8:11:43 PM:     at TLSSocket.onHangUp (_tls_wrap.js:1148:19)
8:11:43 PM:     at Object.onceWrapper (events.js:313:30)
8:11:43 PM:     at emitNone (events.js:111:20)
8:11:43 PM:     at TLSSocket.emit (events.js:208:7)
8:11:43 PM:     at endReadableNT (_stream_readable.js:1064:12)
8:11:43 PM:     at _combinedTickCallback (internal/process/next_tick.js:139:11)
8:11:43 PM:     at process._tickDomainCallback (internal/process/next_tick.js:219:9)
8:11:43 PM: Error: socket hang up
8:11:43 PM:     at TLSSocket.onHangUp (_tls_wrap.js:1148:19)
8:11:43 PM:     at Object.onceWrapper (events.js:313:30)
8:11:43 PM:     at emitNone (events.js:111:20)
8:11:43 PM:     at TLSSocket.emit (events.js:208:7)
8:11:43 PM:     at endReadableNT (_stream_readable.js:1064:12)
8:11:43 PM:     at _combinedTickCallback (internal/process/next_tick.js:139:11)
8:11:43 PM:     at process._tickDomainCallback (internal/process/next_tick.js:219:9)
8:11:43 PM: Error: socket hang up
8:11:43 PM:     at TLSSocket.onHangUp (_tls_wrap.js:1148:19)
8:11:43 PM:     at Object.onceWrapper (events.js:313:30)
8:11:43 PM:     at emitNone (events.js:111:20)
8:11:43 PM:     at TLSSocket.emit (events.js:208:7)
8:11:43 PM:     at endReadableNT (_stream_readable.js:1064:12)
8:11:43 PM:     at _combinedTickCallback (internal/process/next_tick.js:139:11)
8:11:43 PM:     at process._tickDomainCallback (internal/process/next_tick.js:219:9)
8:11:43 PM: error Command failed with exit code 1.

I suspect the issue is related to the API calls to Contentful, but I don’t know for certain. Does anyone have any insight into possible triggers for these errors and how to work around them?

hey there, where are you seeing these errors? Is this related to this post:

If yes, we are actively working on a fix:

We’re seeing them in the deploy logs. For instance: Netlify App.

I saw that other thread but it seemed limited to the Netlify Dev tool, whereas this is happening during the build process.

1 Like

Thanks for that detail! What you’re seeing in your deploy logs is unrelated to anything in the CLI, so that’s a bit of a red herring. I believe those errors are coming from nuxt being unable to connect successfully to some service, which wouldn’t be caused by us - we don’t filter or block network traffic during build. Do you know what connections your build process might be making that could go awry? Perhaps you have access to that remote server, and can look at the logs on that side to try to debug?

Thanks @fool, I suspect that Contentful is at fault then, they’re the only remote service we’re dialing out to during SSG.

1 Like