Not able to connect to GraphQL endpoint graphql.datocms.com

Hi there,

I am working on a project behind our corporate proxy. The GraphQL endpoint works just fine on the browser but when I run my NextJS project which is trying to create a client I get the below error. I do have the environment variables setup for the the proxy. Note that when I run the same project without a proxy it works just fine.

error - FetchError: request to https://graphql.datocms.com/ failed, reason: connect ETIMEDOUT 172.67.11.48:443

Is it something wrong at my end or my requests are being rejected by the endpoint on Dato side when the requests are made through CommandLine and behind a proxy, while the same proxy allows accessing the domain through the browser?

Hello @zaheer.baloch and welcome to the community!

It seems like if the proxy is being able to reach the graphQL endpoint through the browser, and not through node, it seems like some proxy rule created by the proxy administrator could be blocking direct POST requests to that endpoint made through the localhost.
You could individuate this by trying the request on a different network without the proxy, if the request goes through, then the connection is timing out because it is being blocked by one of the proxy server rules.

Hi @m.finamor - The connection does work when not using a proxy. I will check further with internally to investigate this further. Thanks for your help. I would come back and update here once I have an update.

1 Like

unfortunately we don’t have a range of IPs as the GraphQL API is behind Cloudflare CDN, so depending on the region you are doing the calls from there will be a different server responding to you, I hope it works for you?

Update: The issue is resolved. The problem was that I was using fetch API to query the DatoCMS API and fetch api does not take the proxy details from .npmrc or .yarnrc but needs to have the proxy details provided with the actual API call.