ERRORTIMEOUT while making Prismic API Calls - 502 Error

Hi ,

We using @prismicio/client (Version : 6.6.3) for making Prismic API Calls and we seeing issues with intermittent 502 Errors in a day

Error Logs below :

{"line":"prismic call for type plp-content-block and uid: plp-content-91645 failed with FetchError: request to [https://containerstoriesproduction.cdn.prismic.io/api/v2?access_token=MC5WVWp1M2lnQUFGaHZTVk1k.77-977-977-9I1rvv70laGrvv73vv73vv70u77-9Me-_ve-_ve-_vVZOYu-_ve-_vRdMelTvv73vv71077-9eg|https://containerstoriesproduction.cdn.prismic.io/api/v2?access_token=MC5WVWp1M2lnQUFGaHZTVk1k.77-977-977-9I1rvv70laGrvv73vv73vv70u77-9Me-_ve-_ve-_vVZOYu-_ve-_vRdMelTvv73vv71077-9eg] failed, reason: connect ETIMEDOUT 13.225.41.31:443","source":"stdout","tag":"1f0d571962e5"} 


{"line":"prismic call for type plp-content-block and uid: plp-content-91645 failed with FetchError: request to [https://containerstoriesproduction.cdn.prismic.io/api/v2?access_token=MC5WVWp1M2lnQUFGaHZTVk1k.77-977-977-9I1rvv70laGrvv73vv73vv70u77-9Me-_ve-_ve-_vVZOYu-_ve-_vRdMelTvv73vv71077-9eg|*https://containerstoriesproduction.cdn.prismic.io/api/v2?access_token=MC5WVWp1M2lnQUFGaHZTVk1k.77-977-977-9I1rvv70laGrvv73vv73vv70u77-9Me-_ve-_ve-_vVZOYu-_ve-_vRdMelTvv73vv71077-9eg] failed, reason: connect ETIMEDOUT 13.225.41.17:443","source":"stdout","tag":"327a3eca85b7"}*


 {"line":"prismic call for type custom-spaces and uid: custom-closet-landing failed with FetchError: request to [https://containerstoriesproduction.cdn.prismic.io/api/v2/documents/search?q=%5B%5Bat%28document.type%2C+%22custom-spaces%22%29%5D%5D\u0026q=%5B%5Bat%28my.custom-spaces.uid%2C+%22custom-closet-landing%22%29%5D%5D\u0026fetchLinks=product-line-services.name%2Cproduct-line-services.description%2Cproduct-line-services.ctas%2Cproduct-line-services.finishes%2Cproduct-line-services.long_comparison_description%2Cproduct-line-services.short_comparison_description%2Cproduct-line-services.features%2Cproduct-line-services.price_levels%2Cproduct-line-services.comparison_ctas\u0026pageSize=1\u0026ref=Y1Br_hIAACAA6Az7\u0026access_token=MC5WVWp1M2lnQUFGaHZTVk1k.77-977-977-9I1rvv70laGrvv73vv73vv70u77-9Me-_ve-_ve-_vVZOYu-_ve-_vRdMelTvv73vv71077-9eg|**https://containerstoriesproduction.cdn.prismic.io/api/v2/documents/search?q=%5B%5Bat%28document.type%2C+%22custom-spaces%22%29%5D%5Du0026q=%5B%5Bat%28my.custom-spaces.uid%2C+%22custom-closet-landing%22%29%5D%5Du0026fetchLinks=product-line-services.name%2Cproduct-line-services.description%2Cproduct-line-services.ctas%2Cproduct-line-services.finishes%2Cproduct-line-services.long_comparison_description%2Cproduct-line-services.short_comparison_description%2Cproduct-line-services.features%2Cproduct-line-services.price_levels%2Cproduct-line-services.comparison_ctasu0026pageSize=1u0026ref=Y1Br_hIAACAA6Az7u0026access_token=MC5WVWp1M2lnQUFGaHZTVk1k.77-977-977-9I1rvv70laGrvv73vv73vv70u77-9Me-_ve-_ve-_vVZOYu-_ve-_vRdMelTvv73vv71077-9eg] failed, reason: connect ETIMEDOUT 13.225.41.118:443**","source":"stdout","tag":"58561a431bf4"}

Can you please let us know what can be the issue for these TIMEOUTS?

Regards
Balaji

Hi @balaji.ravishankar,

Welcome to the community!

  1. Can you show me how the query you're making looks like?
  2. How you pass your access token when you initialise the client?
  3. How are you passing the ref to the query?

Thanks.

A developer by the name of Akshay will pass you that information after looking into our code

1 Like

Hi @Phil we're using @prismicio/client to communicate with prismic.

This is how we're configuring the prismic client.

import * as prismic from '@prismicio/client';

const repoName = <repo-name>;
const config = {
  accessToken: <permanent-access-token>,
};

const client = prismic.createClient(repoName, config);

Following code is to fetch the data from prismic.

await client.getByUID(<custom-type>, <uid>);

So, to answer your questions we're not doing anything custom. We're using @prismicio/client package only to communicate. And internally this package only making the query and managing session.

How are you passing the ref to the query?
I'm not fully understand what is ref here, but I guess it might be UID reference ID. We're passing UID to the query using utility function like

await client.getByUID(<type>, <uid>)

Hi Askay,

Can you try updating how you create your client?

const client = prismic.createClient(repoName, { ...config, })

Since you're using the @prismicio/client you can ignore the ref question.