Hi
during Nuxt routes generation on Netlify I'm getting the following error for some routes.
It doesn't happen always on the same pages but randomly, in different pages each generation.
FetchError: request to https://xxxx.cdn.prismic.io/api/v2/documents/search?page=1&pageSize=1&lang=en-US&ref=Ybi1ZRUAACgAfuP0&q=%5B%5Bat(document.type%2C%20%22footer%22)%5D%5D failed, reason: socket hang up
Async calls inside the a map functions make requests at the same time and that can overload the server. One way to handle this is susing a library like PQueue
I'm now using reduce instead of map and also caching the NuxtServerInit content in order to get common footer's data only at first page generation. Furthermore I added an interval to Nuxt generation to generate a page (and so call prismic) every 300ms instead of 0.
I'm not getting socket error anymore but with some pages I'm getting this new error:
{"message":"request to https://xxxxx.cdn.prismic.io/api/v2/documents/search?page=1&pageSize=20&lang=it-it&fetch=post.category&ref=YcrajBEAACIA6Ke5&q=%5B%5Bat(my.post.uid%2C%20%22post-slug%22)%5D%5D failed, reason: read ECONNRESET","type":"system","errno":"ECONNRESET","code":"ECONNRESET"}'
I'm still getting the following error for different pages and custom types:
{"message":"request to https://xxx.cdn.prismic.io/api/v2/documents/search?page=1&pageSize=100&lang=en-US&orderings=%5Bmy.post.date%20desc%5D&fetchLinks=blog_category.name&ref=123&q=%5B%5Bat(document.type%2C%20%22post%22)%5D%5D failed, reason: socket hang up","type":"system","errno":"ECONNRESET","code":"ECONNRESET"}'
Please take a look at this similar thread. This type of error are specific to each project code, but it might give you an idea of where you can start troubleshooting the error while generating the project again: