Closed barthofu closed 2 years ago
Maybe try updating your Gatsby to 4.13.1 or later there was a race condition that caused random build failure during single threaded builds like Gitlab Runner or Netlify. https://github.com/gatsbyjs/gatsby/pull/35513
[SOLVED]
After days and days of debugging we found that it was issued by NGINX (strapi side). Indeed, the plugin was spamming way to much (we have quite a huge strapi db and nearly 6.5k uploads) the server, and nginx would randomly block requests. We solved it by optimizing the nginx server.
Any chance you mind reporting what optimization you made to NGINX?
Ditto, I have the exact same problem. @barthofu what did you do on the nginx side to fix this?
Ok, I think I figured out what the problem was on my setup. I noticed that when the build was crashing, this would come up on the nginx logs:
20:08:10 [alert] 10#10: *3768 512 worker_connections are not enough while connecting to upstream, client: xxx.xxx.xxx.xxx, server: mydomain.world, request: "GET /api/upload/files?filters[url]=/uploads/img.JPG HTTP/1.1", upstream: "xxxxxxx", host: "xxxxxxx:1337"
I increased worker_connections
in my nginx.conf like this:
events {
worker_connections 2048;
}
Clearly gatsby build was requesting all my images at the same time (I have about 500), and the worker ran out of connections. Increasing the number of connections did the trick. @MRDRMUFN I hope this helps you <3
Oh yeah really sorry i haven't saw you answers until now 😭 But yeah it was the max number of worker_connections that did the trick 🙏
Sorry once again...
The error
The error happens during the build just after fetching the data from Strapi. It is relatively random, and can take several shapes (also randomly):
Error 500 (internal server) :
ECONNRESET
Socket
Comments
Requirements
node.js
: 14.19.1gatsby
: 4.5.3gatsby-source-strapi
: 2.0.0strapi
: 4.1.9sqlite3
as database for my strapi app