ERROR #11321 PLUGIN
"gatsby-source-prismic" threw an error while running the sourceNodes lifecycle:
Unexpected status code [502] on URL https://OUR_SITE.cdn.prismic.io/api/v2/documents/search?page=2&pageSize=100&fetchLinks=&lang=*&ref=YuF5yhIAACIAn4f_&q=%5B%5D
Error: Unexpected status code [502] on URL https://OUR_SITE.cdn.prismic.io/api/v2/documents/search?page=2&pageSize=100&fetchLinks=&lang=*&ref=YuF5yhIAACIAn4f_&q=%5B%5D
Thanks for reaching out; I have responded to you on the JIRA ticket you have created, and if you don't mind, let's continue the conversation here
As I mentioned in the JIRA ticket, I have been able to reproduce the issue, and I have created an Issue in our tracker to have somebody from our dev team work on it; we will let you know once we have any updates.
We discovered that the error is associated with payment accounts. We have a project with a Prismic free account and it compiles without problems. In this project we use the same stack and the same versions of the libraries.
I’ve got an update from our dev team, and in fact, you have actually hit the response size limit of 6MB. In that case, we should return a proper error, but there was a bug we have fixed and will be deployed soon in a PR.
The workaround is to reduce the page size to downsize the response payload.
Please let us know if you need any further assistance,
HI @Manuel Ortega I’ve got a response from our dev team:
You are probably correct in that the API is returning too much data as a result of using the maximum page size (100 documents). The fix is to limit the page size to something smaller than the maximum.
Because the project is using an older version of gatsby-source-prismic (v3 rather than the latest, v5), the pageSize option is not available.
Normally we would ask developers to update to the latest version which includes pageSize support.
However, our dev team made an exception and back-ported the feature to gatsby-source-prismic since you have been blocked for a few weeks, and migrating to v5 is not a quick task.
You can update the Gatsby project to gatsby-source-prismic v3.4.0 using the following command:
npm install gatsby-source-prismic@v3
Once the project is using v3.4.0, pageSize should be supported. I suggest setting pageSize to 50 and increase/decrease the number to find the largest consistently working number.