Error on locally development

Since a while I'm developing with NextJS and Prismic together. Yet I haven't come acress the following error that prevents me to get data locally. The moment everything hits the live servers its working perfectly fine.

The following error popups:

FetchError: request to https://dierenkliniek[TOKEN REMOVED]&q=%5B%5Bat(  document.type%2C%20%22homepage%22)%5D%5D failed, reason: connect ETIMEDOUT
at ClientRequest.<anonymous> (C:\path\to\development\node_modules\@prismicio\client\node_modules\node-fetch\lib\index.js:1461:11)
at ClientRequest.emit (events.js:321:20)
at TLSSocket.socketErrorListener (_http_client.js:426:9)
at TLSSocket.emit (events.js:321:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21) { message: 'request to[TOKEN REMOVED]&q=%5B%5Bat(document.type%2C%20%22homepage%22)%5D%5D failed, reason: connect ETIMEDOUT', type: 'system', errno: 'ETIMEDOUT', code: 'ETIMEDOUT' }

The things I'm wondering about how this suddenly happend since developing locally was fine until a few days back. (Or maybe longer, haven't really actively maintained the code base in the past few weeks)

So far I haven't changed much in the code base only other than the repository where prismic comes from: prismic-javascript > @prismicio/client

I've found multiple topics on this issue but none of them brought me the solution, neither did the TO respond to any answers from the staff, thus my very own topic.

Thanks in advance.

Hi Robbert,

Welcome to the Prismic community,

Well, do you get this error every time or only sometimes? This error means the request to your repository has timed out; this can be due to many factors, but this can be related to a local network issue based on what you said that on a remote server, it works fine?

To be sure, you can do the query manually in your browser URL bar to see if it is related to your device/network.

to debug further this issue, I would need to have access to your code

Looking forward to your reply,

Hi Fares!

Seeing the responses yesterday it happens like 90% of the time. Sometimes I've got an instant respons and sometimes it just errors on me down. (Especially when I call multiple documents of different types along the way in a different request)

I've tried querying the repo with the normal URL which works fine. So I find it quite odd it just dies on me sometimes. Therefore said, it has worked before but since a couple days after some maintenance it just stopped. (While there were 0 changes to the prismic code other than mentioned above)

I'll see if I can give you a piece of code that I'm using to query the data. I'll post that within an hour of this reply.

Oh, the access token is valid. Even thought that that was the issue but this isn't. (Since it's working 10% of the time)

Thanks in advance!

1 Like

Great, looking forward to that.

Hi Fares,

Hereby the pieces of code I wanted to show you;


import Prismic from "@prismicio/client";

export const apiEndpoint = "";
export const accessToken = "[TOKEN REMOVED]";

const createClientOptions = (req = null, prismicAccessToken = null) => {
    const reqOption = req ? { req } : {}
    const accessTokenOption = prismicAccessToken ? { accessToken: prismicAccessToken } : {}
    return {

export const Client = (req = null) => (
    Prismic.client(apiEndpoint, createClientOptions(req, accessToken))

-- Query --

I hope this helps a bit with some insights.

Oh some "fun" insights; I've been working yesterday on the project. Seemed be working back then.

But I was too hopefull. The repository stopped responding to me again tonight. I really think its a problem that lies within Prismic itself rather than the code that's written.

Well I still believe that this error is related to some Network issue on your side, are you using a proxy?

I've checked your code and it doesn't seem to have an issue, and the error you are getting is not coming from Prismic but from your local Node server.

Here is what I found online that can be related to this issue:

For troubleshooting purposes, you can try to extend the timeout for your server to determine if you have any bad configurations in your local project (I dought it)

This issue has been closed due to inactivity. Flag to reopen.