gatsby-source-craft icon indicating copy to clipboard operation
gatsby-source-craft copied to clipboard

FetchError ETIMEDOUT prevents build, no way to increase timeout?

Open kije opened this issue 3 years ago • 1 comments

Description

Recently I started getting FetchError: request to https://my-craft-url.com/api failed, reason: connect ETIMEDOUT <IP>:443 almost all the time when running a development/production build of my project locally (Builds in CI pipeline seem to work fine so far).

I searched for a way to increase the connection timeout with node-fetch etc... but couldn't find a way to do it. I also tried to reduce the concurrency option (set it to 1 for example) but this didn't help either.

I have the error with gatsby v3 as well as gatsby v4 (via the gatsby-v4 branch.

So I was wondering if there is some way how I can increase the connection timeout for the connections used by this plugin?

Error

info Clearing previous fragments.
info Clearing previous fragments.
info Writing default fragments.
info Clearing previous fragments.
info Clearing previous fragments.
info Writing default fragments.
info Writing default fragments.
info Writing default fragments.
info Clearing previous fragments.
info Clearing previous fragments.
info Writing default fragments.
info Writing default fragments.
info Clearing previous fragments.
info Writing default fragments.
success fetching camera_Tag - 25.180s

 ERROR #11321  PLUGIN

"gatsby-source-craft" threw an error while running the sourceNodes lifecycle:

request to  https://my-craft-url.com/api failed, reason: connect ETIMEDOUT <IP>:443



  FetchError: request to https://my-craft-url.com/api failed, reason: connect ETIMEDOUT <IP>:443
  
  - index.js:1483 ClientRequest.<anonymous>
    [my-gatsby-project]/[node-fetch]/lib/index.js:1483:11
  
  - node:events:390 ClientRequest.emit
    node:events:390:28
  
  - node:domain:475 ClientRequest.emit
    node:domain:475:12
  
  - node:_http_client:447 TLSSocket.socketErrorListener
    node:_http_client:447:9
  
  - node:events:390 TLSSocket.emit
    node:events:390:28
  
  - node:domain:475 TLSSocket.emit
    node:domain:475:12
  
  - destroy:157 emitErrorNT
    node:internal/streams/destroy:157:8
  
  - destroy:122 emitErrorCloseNT
    node:internal/streams/destroy:122:3
  
  - task_queues:83 processTicksAndRejections
    node:internal/process/task_queues:83:21
  

not finished source and transform nodes - 26.243s
not finished fetching photo_photo_Entry - 25.868s
not finished fetching photos_Asset - 25.938s
not finished fetching film_Tag - 25.860s
not finished fetching lens_Tag - 25.879s
not finished fetching photoTags_Tag - 25.872s
not finished fetching projectTags_Tag - 25.884s
not finished fetching User - 25.959s

kije avatar Jan 07 '22 22:01 kije

Added some additional options in PR https://github.com/craftcms/gatsby-source-craft/pull/71 which could help to mitigate this issue

kije avatar Feb 04 '22 23:02 kije