While using Strapi V4 graphQL with Apollo client in NextJS application, I’m getting this error:
Unhandled error during request: ApolloError: request to /graphql failed, reason: socket hang up.
Firstly, the app builds when building locally, and fails when building on the cloud. So it is likely a DevOps/Config problem.
I’m using AWS Amplify for NextJS and an AWS EC2 instance for Strapi. The instance RAM and CPU utilization do spike during build time, but the average usage is pretty low. I’m using PostgreSQL which is hosted on the same instance.
Strapi Version: 4.1.2
Operating System: Ubuntu 20.04.3 LTS
Database: PostgreSQL v12
Node Version: 14.18.0
NPM Version: 6.14.15
Yarn Version: 1.22.17
@DMehaffy Looking for inputs. Thank you in advance!
Not familiar with that error, id check the server side logs and see if the request is actually coming through.
It is a 199-page site. 198 pages build, and, the error appears on the 199th page. There are some APIs other than Strapi which I’m fetching data from, and, these are pretty slow. If I remove these non-Strapi APIs, the build time reduces, and, the site builds successfully.
I’ve already changed this - “staticPageGenerationTimeout: 600” in NextJS config. Also, on Amplify, I’ve raised the build timeout to 60 mins.
Sounds like the issue is upstream from Strapi and is a build time-limit.
I’m a bit surprised something would take 60 minutes to build though O_o
Ah! Consuming some API that has a rate limit, so, staying below the rate limit => increased build time!