Build Failing on Random GraphQL API Calls

Netlify Site Name: peaceful-mccarthy-2e0b38

Error:
FetchError: invalid json response body at https://tdpprods.wpengine.com/graphql reason: Unexpected token < in JSON at position 0

Hello! I’m getting a failing build seemingly randomly on a NextJS site, and I could use some ideas here. The error is pretty typical when, for example, NextJS expects a prop, but it doesn’t exist. But in this case the failing pages are different on each build attempt, which seems to rule that out. I’ve updated plugin-nextjs to the most recent minor version. The only thing that comes to mind is a possible communication issue with the CMS through GraphQL.

I attempted to include logs here but even one puts me over the character limit for the post, so for now I’ll just add summaries for each attempt:

Failed Pre-renders Attempt 3
6:17:33 PM: 	/about
6:17:33 PM: 	/apply/[slug]: /apply/jail-screening-specialist-1st-shift
6:17:33 PM: 	/apply/[slug]: /apply/peer-recovery-specialist
6:17:33 PM: 	/apply/[slug]: /apply/peer-support-specialist-4
6:17:33 PM: 	/apply/[slug]: /apply/treatment-court-case-manager-2
6:17:33 PM: 	/careers
6:17:33 PM: 	/careers/[slug]: /careers/peer-recovery-specialist
6:17:33 PM: 	/careers/[slug]: /careers/recovery-support-coordinator
6:17:33 PM: 	/careers/[slug]: /careers/treatment-court-case-manager-2
6:17:33 PM: 	/news/[slug]: /news/diversifying-your-nonprofits-revenue-how-you-slice-the-pie-matters
6:17:33 PM: 	/news/[slug]: /news/foundation-covid-response-expected-for-long-haul
6:17:33 PM: 	/news/[slug]: /news/staff-retention-a-major-problem-for-npos
6:17:33 PM: 	/news/[slug]: /news/the-covid-19-effect-on-wisconsins-nonprofit-sector
6:17:33 PM: 	/news/[slug]: /news/virtual-proposal-writing-workshop
Failed Pre-renders Attempt 2
6:06:22 PM: 	/apply/[slug]: /apply/recovery-support-specialist
6:06:22 PM: 	/apply/[slug]: /apply/treatment-court-case-manager-2
6:06:22 PM: 	/news/[slug]: /news/100-fundraising-tasks-for-your-nonprofits-board
6:06:22 PM: 	/news/[slug]: /news/change-could-ease-student-loan-debt
6:06:22 PM: 	/news/[slug]: /news/data-on-how-the-pandemic-and-economic-crises-are-affecting-nonprofits
6:06:22 PM: 	/news/[slug]: /news/how-to-qualify-for-public-service-loan-forgiveness-and-avoid-the-traps
6:06:22 PM: 	/news/[slug]: /news/npos-added-1-4-trillion-to-u-s-economy
6:06:22 PM: 	/news/[slug]: /news/the-difference-principle-press-release
6:06:22 PM: 	/news/[slug]: /news/the-great-resignation-a-call-for-change-in-organizational-culture
Failed Pre-renders Attempt 1
5:59:50 PM: 	/apply/[slug]: /apply/jail-screening-specialist-1st-shift
5:59:50 PM: 	/apply/[slug]: /apply/jp-em-specialist
5:59:50 PM: 	/apply/[slug]: /apply/peer-recovery-specialist
5:59:50 PM: 	/careers/[slug]: /careers/peer-recovery-specialist
5:59:50 PM: 	/news/[slug]: /news/a-guide-to-outsourcing-for-nonprofit-organizations
5:59:50 PM: 	/news/[slug]: /news/are-you-using-the-best-fundraising-tool-for-your-nonprofit
5:59:50 PM: 	/news/[slug]: /news/change-could-ease-student-loan-debt
5:59:50 PM: 	/news/[slug]: /news/data-on-how-the-pandemic-and-economic-crises-are-affecting-nonprofits
5:59:50 PM: 	/news/[slug]: /news/diversifying-your-nonprofits-revenue-how-you-slice-the-pie-matters
5:59:50 PM: 	/news/[slug]: /news/nonprofits-have-struggled-to-meet-service-organizational-demands
5:59:50 PM: 	/news/[slug]: /news/npos-added-1-4-trillion-to-u-s-economy
5:59:50 PM: 	/news/[slug]: /news/the-great-resignation-a-call-for-change-in-organizational-culture
5:59:50 PM: 	/news/[slug]: /news/virtual-proposal-writing-workshop
5:59:50 PM: 	/news/[slug]: /news/what-10-nonprofits-are-doing-to-aid-ukraine-and-its-refugees
5:59:50 PM: 	/services

I’ll add the logs on request, I suppose.

Thanks in advance for your help!

Update: I did update the WP plugin that’s used as the endpoint, WPGraphQL to the current version. This didn’t resolve the issue. The site deploys without issue locally, even when I use the production Wordpress as the endpoint. This seems to suggest there’s some kind of issue with the deploy.

Update 2: Retrying deploy from previously successful builds on both my Netlify NextJS sites that use the WPGraphQL end point, including this one also fail with these same errors.

I was able to determine that this was the result of rate limiting by WPEngine. For resolution to this type of issue see here.

I do have a follow-up question, however. WPEngine says they haven’t changed their rate limiting policy. My code base has changed in any way that would impact request rates at build time. So I’m wondering if Netlify increased the rate at which is makes requests during deploy time.

It’s your code that sends requests, not Netlify.

But yes, we did make some improvements to our build clusters and some folks have reported that the builds now appear to be faster. So, chances are, due to the speed increase, your code is now having rate-limits. We can’t slow down the performance though.