500 error querying custom type

Querying works for all custom post types of mine, except this one.. we are paid users. I have the following code to query the custom type:

const API = await Prismic.api(PRISMIC_API_URL);
        const response = await API.query(
          Prismic.Predicates.at('document.type', 'ljc_case'),
          {
            orderings: '[my.ljc_case.date desc]',
            ...params
          }
        );

The Prismic api response is: "Error: Unexpected status code [500] on URL https://liberty-justice-center.cdn.prismic.io/api/v2/documents/search?page=1&pageSize=5&orderings=[my.ljc_case.date%20desc]&ref=YNls_RIAACIAlefp&q=[[at(document.type%2C%20"ljc_case")]]"

Hi Jake,

Welcome to the community!

I quickly checked your API Browser for the type you're querying and it's coming back broken, which suggested there's an error in this Custom Type or at least one of the documents using a newer version of this Custom Type:
https://liberty-justice-center.prismic.io/api/v2/documents/search?ref=YNls_RIAACIAlefp&q=[[at(document.type%2C+"ljc_case")]]#format=json

Have you made any changes in the Custom Type JSON recently which could be causing this?

Further investigating would suggest it's the 3rd result, whatever that is.

https://liberty-justice-center.prismic.io/api/v2/documents/search?ref=YNls_RIAACIAlefp&q=[[at(document.type%2C+"ljc_case")]]&pageSize=1&page=3#format=json

Thanks.

OK, so the team investigated this further. They're pretty sure you did an import that causes an issue in the API because of unexpected formatting. Specifically a document link.

There is a Group “Legal Briefs” defined in the custom type “LJC Case”. One of them is a document link (broken). The other links are attachment links.

To resolve this you need to go over all “LJC Case” documents and remove these broken document links.

The other option is to wait until we deploy the fix they made, which would be deployed this week or next.

Thanks a ton Phil! I’ve passed this along to the appropriate team members.

Best Regards,

Joey Livingston

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.