I'm experiencing an issue when building my Next.js project in GitHub Actions. The build process gets stuck for several minutes while trying to fetch Google Fonts, and sometimes it fails completely. Here is the relevant error log:
#12 10.13 Creating an optimized production build ...
#12 52.98 request to https://fonts.gstatic.com/s/ubuntu/v20/4iCv6KVjbNBYlgoC1CzjvWyNPYZvg7UI.woff2 failed, reason:
#12 52.98
#12 52.98 Retrying 1/3...
#12 52.99 request to https://fonts.gstatic.com/s/ubuntu/v20/4iCv6KVjbNBYlgoC1CzjtGyNPYZvg7UI.woff2 failed, reason:
#12 52.99
#12 52.99 Retrying 1/3...
#12 52.99 request to https://fonts.gstatic.com/s/ubuntu/v20/4iCv6KVjbNBYlgoC1CzjvGyNPYZvg7UI.woff2 failed, reason:
#12 52.99
#12 52.99 Retrying 1/3...
#12 53.00 request to https://fonts.gstatic.com/s/ubuntu/v20/4iCv6KVjbNBYlgoC1Czjs2yNPYZvg7UI.woff2 failed, reason:
#12 53.00
#12 53.00 Retrying 1/3...
#12 53.01 request to https://fonts.gstatic.com/s/ubuntu/v20/4iCv6KVjbNBYlgoC1CzjvmyNPYZvg7UI.woff2 failed, reason:
#12 53.01
#12 53.01 Retrying 1/3...
#12 53.01 request to https://fonts.gstatic.com/s/ubuntu/v20/4iCv6KVjbNBYlgoC1CzjsGyNPYZvgw.woff2 failed, reason:
#12 53.01
#12 53.01 Retrying 1/3...
#12 53.02 request to https://fonts.gstatic.com/s/ubuntu/v20/4iCs6KVjbNBYlgoKew72nU6AF7xm.woff2 failed, reason:
.
.
.
It retries multiple times, and in some cases, it succeeds after ~7 minutes. However, occasionally, the build fails entirely because it cannot fetch the fonts.
Running the build locally works fine. Any ideas on how to shorten the build time and fix this error?