Unexpected status code [502] | gatsby-source-prismic plugin

Hey everyone,

From today the Prismic API started to fail. We have this configuration:

"gatsby": "3.14.6",
"gatsby-source-prismic": "^3.3.1",

This is the error:

 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

Is there any change with this? Thank you

HI @manuelo

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.

Best,
Fares

Ok thank you very much. Please send me updates on this. the marketing team is waiting for a campaign

image001.png

1 Like

Hi @manuelo
There are still no updates on the issue created; I will let you know in case of any updates.

We continue with this error. they can help us?

Hi @manuelo
There are still no updates on the issue created, and I have reminded our devs of the issue.

Hi @Fares. I work in the same team as Manuel, we're having this issue. We are not being able to build our app. Please give us a hand with this one.

Thanks.

Hi @fhuneeus, our dev team confirms it is an API issue and is currently investigating the root cause.

The Platinum plan has Priority support and we expect some response from July 28.

Ok, well, I have followed up again with our dev team and informed them that it is a blocking issue for you.

Hi, Any progress with this?

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.

Hi

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,

Fares

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.

This was no solution. In the end, the team decided to migrate the entire code base due to lack of support.


Hey @manuelo, this seems like a different problem. Your console is throwing a 422 error. Maybe there's an issue with one of your queries?