11y Image causes error on Netlify: "Client network socket disconnected before secure TLS connection"

My Setup:

  • Static site generated with 11ty
  • Images served from Strapi Cloud
  • Uses 11ty-image plugin

Problem

When I build my site locally, everything runs smoothly. However, during deployment on Netlify, I occasionally encounter the following error:

[11ty] request to https://legendary-wisdom-eda531808d.media.strapiapp.com/consortium_1_df31a3b992.svg failed, reason: Client network socket disconnected before secure TLS connection was established (via FetchError)

Note: This error isn’t consistent. Sometimes the deployment completes without any hitches.

Site URL: https://phenomenal-zabaione-990446.netlify.app/

Any recommendations on how to ensure a consistent and successful build on Netlify?

Here you can see the full error message:

10:12:42 AM: [11ty] Writing dist/blog/the-three-levels-of-confidential-computing/index.html from ./src/blog/blogPost.njk
10:12:42 AM: [11ty] Writing dist/blog/security/index.html from ./src/blog/tag.njk
10:12:42 AM: [11ty] Writing dist/blog/fundamentals/index.html from ./src/blog/tag.njk
10:12:42 AM: [11ty] Writing dist/blog/company/index.html from ./src/blog/tag.njk
10:12:43 AM: [11ty] Writing dist/blog/product/index.html from ./src/blog/tag.njk
10:12:43 AM: [11ty] Writing dist/blog/insights/index.html from ./src/blog/tag.njk
10:12:43 AM: [11ty] Unhandled rejection in promise: (more in DEBUG output)
10:12:43 AM: [11ty] request to https://legendary-wisdom-eda531808d.media.strapiapp.com/consortium_1_df31a3b992.svg failed, reason: Client network socket disconnected before secure TLS connection was established (via FetchError)
10:12:43 AM: [11ty]
10:12:43 AM: [11ty] Original error stack trace: FetchError: request to https://legendary-wisdom-eda531808d.media.strapiapp.com/consortium_1_df31a3b992.svg failed, reason: Client network socket disconnected before secure TLS connection was established
10:12:43 AM: [11ty]     at ClientRequest.<anonymous> (/opt/build/repo/node_modules/node-fetch/lib/index.js:1505:11)
10:12:43 AM: [11ty]     at ClientRequest.emit (node:events:514:28)
10:12:43 AM: [11ty]     at TLSSocket.socketErrorListener (node:_http_client:501:9)
10:12:43 AM: [11ty]     at TLSSocket.emit (node:events:514:28)
10:12:43 AM: [11ty]     at emitErrorNT (node:internal/streams/destroy:151:8)
10:12:43 AM: [11ty]     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
10:12:43 AM: [11ty]     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
10:12:43 AM: Caching: https://legendary-wisdom-eda531808d.media.strapiapp.com/Gov_Tech_Campus_1045x360_108726b382.svg

Sounds like a network error which can never be 100% resolved - could be on our end, could be on Strapi’s end. You should try adding a retry logic to your code.