aaron1
(Aaron Ransley)
March 17, 2021, 7:31pm
1
Hi there support crew,
My team and I are running into occasional /api/v2
outages when attempting to create a new instance of the Prismic JS client.
We're using Nuxt as well as the @nuxtjs/prismic module .
Both locally and on our Netlify build pipeline, we're seeing this error:
[error] request to https://<repository_name>.prismic.io/api/v2 failed, reason: connect ETIMEDOUT 3.226.167.146:443
...which in turn causes the client instance to not be created, leading to further errors:
[error] Failed to init Prismic API, preventing app fatal error.
and
TypeError: $prismic.api.getByUID is not a function
Please let me know if I can supply any additional information!
1 Like
Hey @aaron1 ,
Thanks for posting this error! I haven't seen this one specifically before, but I have one suggestion off the top of my head: It looks like you're not using the CDN endpoint. Try reformatting your endpoint like this:
https://<repository_name>.cdn.prismic.io/api/v2
And see if that helps.
If that's not the issue, I can talk to our engineering team.
Sam
1 Like
aaron1
(Aaron Ransley)
March 18, 2021, 4:20pm
4
Ah that's a great point, thank you Sam!
I will update the endpoint to include the CDN subdomain and let you know if we run into further issues with timeouts.
1 Like
aaron1
(Aaron Ransley)
March 24, 2021, 6:22pm
6
Hi @samlittlefair , we had a blip yesterday evening with an ECONNRESET
error:
During nuxt generate
, we ran into this error:
[fatal] request to https://<repo_name>.cdn.prismic.io/api/v2/documents/search?page=1&pageSize=100&ref=<ref_here>&q=%5B%5Bat(document.type%2C%20%22journal_entry%22)%5D%5D failed, reason: read ECONNRESET
I obfuscated our repo name and the ref, but that's a verbatim paste from Netlify build logs.
Any ideas about what could cause a ECONNRESET, and if it's something we should guard against (i.e. auto-retry in our Netlify builds, etc?)
Hey @aaron1
I have indeed seen a similar error with nuxt generate
. At the time, I offered these troubleshooting steps:
Hey Kristian,
Thanks for your patience! My colleague took a look at your project, and identified a few ways to troubleshoot:
First of all, in ~/store/ui.js, you use a do/while loop to fetch your content. Do/while loops don’t run asynchronously, so that is likely causing some errors (more info here ). You could replace it with a recursive function, like this:
const getPages = async (context) => {
const data = []
let pageNum = 1
let lastResult = []
const fetch = async () => {
const …
If I remember correctly, it seemed like it might be a problem with making 1000s of requests server-side.
Let me know if any of those troubleshooting steps help or not.
Sam
aaron1
(Aaron Ransley)
March 25, 2021, 6:56pm
8
Hi @samlittlefair , after adding some logging, I can confirm this is occurring (occasionally) during the first query to the API, where only a single page of 100 results is being returned:
return await $prismic.api.query(
$prismic.predicates.at('document.type', 'journal_entry'),
{ pageSize: 100 }
)
Hi @aaron1 ,
Could you send me your project files, either in a GitHub repo or ZIP file? If so, I can take a closer look to see if I can find a cause of the error.
Sam
PS: I'll be out on Monday and Tuesday, so I probably won't get to respond until Wednesday.
samlittlefair
(Sam Littlefair)
closed , flag & select 'Something Else' to reopen.
April 7, 2021, 10:19am
10
This issue has been closed due to inactivity. Flag to reopen .
I'm experiencing the same issue as the OP. It doesn't always happen but I get this error from time to time, specially when using the similar query but we only query 6 records at a time with a maxResults of 10. Is there anyway to check the logs on prismic side?
Pau
April 6, 2022, 5:49pm
13
Hello @levijesica , we haven't detected any irregularities in the API. Are you still experiencing this error?
You can always check our status page if necessary:
https://status.prismic.io/
levijesica
(Jesica Levi)
April 11, 2022, 10:40pm
16
yes, the error happens from time to time but the error says that the server is not reachable
Pau
April 13, 2022, 1:08am
18
Can you share any logs that you see in the console?
Getting timeouts
9:22:05 PM: [error] /club-journal/mexico-city-event-recap/
9:22:05 PM:
9:22:05 PM: FetchError: request to https://exclusiveresorts.cdn.prismic.io/api/v2?access_token=ailed , reason: connect ETIMEDOUT 108.156.172.10:443
9:22:05 PM: at ClientRequest. (/opt/build/repo/node_modules/cross-fetch/node_modules/node-fetch/lib/index.js:1491:11)
9:22:05 PM: at ClientRequest.emit (node:events:513:28)
9:22:05 PM: at TLSSocket.socketErrorListener (node:_http_client:494:9)
9:22:05 PM: at TLSSocket.emit (node:events:513:28)
9:22:05 PM: at emitErrorNT (node:internal/streams/destroy:157:8)
9:22:05 PM: at emitErrorCloseNT (node:internal/streams/destroy:122:3)
9:22:05 PM: at processTicksAndRejections (node:internal/process/task_queues:83:21)
9:22:05 PM: [error] request to https://exclusiveresorts.cdn.prismic.io/api/v2?access_token== failed, reason: connect ETIMEDOUT 108.156.172.10:443
9:22:05 PM: at ClientRequest. (node_modules/cross-fetch/node_modules/node-fetch/lib/index.js:1491:11)
9:22:05 PM: at ClientRequest.emit (node:events:513:28)
9:22:05 PM: at TLSSocket.socketErrorListener (node:_http_client:494:9)
9:22:05 PM: at TLSSocket.emit (node:events:513:28)
9:22:05 PM: at emitErrorNT (node:internal/streams/destroy:157:8)
9:22:05 PM: at emitErrorCloseNT (node:internal/streams/destroy:122:3)
9:22:05 PM: at processTicksAndRejections (node:internal/process/task_queues:83:21)
9:22:05 PM: [success] Generated route "/residences/nantucket-massachusetts/"
9:22:05 PM: [success] Generated route "/residences/new-york-city-new-york/"
9:22:05 PM: [success] Generated route "/residences/london-england/"
9:22:06 PM: [success] Generated route "/residences/peninsula-papagayo-costa-rica/"
9:22:06 PM: [success] Generated route "/residences/phuket-thailand/"
9:22:06 PM: [success] Generated route "/residences/st-barts-french-west-indies/"
9:22:06 PM: [success] Generated route "/residences/sun-valley-idaho/"
9:22:06 PM: [success] Generated route "/residences/sonoma-california/"
9:22:07 PM: [success] Generated route "/residences/puglia-italy/"
9:22:07 PM: [success] Generated route "/residences/steamboat-springs-colorado/"
9:22:07 PM: [success] Generated route "/residences/telluride-colorado/"
9:22:07 PM: [success] Generated route "/residences/newport-beach-california/"
9:22:07 PM: [success] Generated route "/residences/snowmass-colorado/"
9:22:08 PM: [success] Generated route "/residences/vabbinfaru-maldives/"
9:22:08 PM: [success] Generated route "/residences/nendaz-switzerland/"
9:22:08 PM: [success] Generated route "/residences/nassau-bahamas/"
9:22:08 PM: [success] Generated route "/residences/lake-como-italy/"
9:22:08 PM: [success] Generated route "/residences/istanbul-turkey/"
9:22:09 PM: [success] Generated route "/residences/lang-co-vietnam/"
9:22:09 PM: [success] Generated route "/residences/ibiza-spain/"
9:22:09 PM: [success] Generated route "/residences/las-vegas-nevada/"
Pau
February 27, 2023, 5:48pm
23
Thanks for the information. I'll send it to the dev team. I'll let you know what we find.
Pau
February 28, 2023, 1:48pm
25
Hey @williambell9708 , which platform are you using (e.g. Netlify)?