question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: connect ETIMEDOUT

See original GitHub issue

Description

I can’t launch / build the project because the plugin constantly throws ETIMEDOUT error (most often for MediaItem).

Steps to reproduce

Just follow this instruction: https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-wordpress/docs/getting-started.md

gatsby-config.js

{
  resolve: 'gatsby-source-wordpress',
  options: {
    url: process.env.WPGRAPHQL_URL,
  },
}

Then

yarn start

Expected result

Expect that the project will be launched and the requests will be fulfilled.

  • how to increase timeout?
  • can I possibly skip these errors?

Actual result

Some time for random query: изображение

And for MediaItem (very often)

120539428-3ee9a900-c3f0-11eb-9814-eaf239628f52

Environment

изображение

What I tried

  1. package.json (didn’t help)
"develop": "GATSBY_CONCURRENT_DOWNLOAD=5 gatsby develop",
  1. config options (didn’t help)

gatsby-config.js

{
  // ...
  MediaItem: {
    localFile: {
      requestConcurrency: 5,
    },
    lazyNodes: false,
  },
  html: {
    useGatsbyImage: true,
    fallbackImageMaxWidth: 200,
    createStaticFiles: true,
    imageMaxWidth: 756,
  },
  schema: {
    timeout: 3000000,
    requestConcurrency: 5,
  },
  // ...
}

Halp!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ThyNameIsMudcommented, Jun 4, 2021

Timeouts for creating a new node aren’t directly applied to fetching a remote node. Instead of using gatsby-source-filesystem the gatsby-source-wordpress plugin decided to reimplement it.

https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-remote-file-node/index.js#L58

These timeouts need to be adjustable because there is no one-size-fits-all solution here. These calls ALWAYS fail after a threshold. This is the second time an issue like this has burned me, the first time was from the gatsby-source-filesystem which I submitted the fix for. Now it’s this reimplemented solution that needs it.

1reaction
ThyNameIsMudcommented, Jun 9, 2021

node_modules/gatsby-source-wordpress/dist/steps/source-nodes/create-nodes/create-remote-file-node/index.js

Look for got.stream in the file and the timeout associated. Change it to look like

const responseStream = got.stream(url, {
    headers,
    timeout: { send: CONNECTION_TIMEOUT },
    retries: CONNECTION_RETRY_LIMIT,
    ...httpOpts
});

This will have the timeout execute when the socket is connected instead of when it’s queued. The documentation notes how the times are treated: https://github.com/sindresorhus/got/tree/v11.7.0#timeout

You may want to adjust CONNECTION_TIMEOUT or STALL_TIMEOUT as well.

You will want to use something like patch-patch to make the change until this is properly fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

What could cause "connect ETIMEDOUT" error when the URL ...
The URL above cause some issues because HTTP does not exist at the beginning of URL so Just change it to it should...
Read more >
Fixing Etimedout error - Postman
The ETIMEDOUT error means that the request took more time than the webserver configuration allows and the connection has been closed by the...
Read more >
How do I resolve the error: connect etimedout
ETIMEDOUT (Operation timed out): A connect or send request failed because the connected party did not properly respond after a period of time....
Read more >
HOW can i solve the Error: connect ETIMEDOUT when try to ...
The error always states the Error: connect ETIMEDOUT… the funny thing is that i can connect the cluster with mysql client terminal and...
Read more >
Error: connect ETIMEDOUT - Salesforce Stack Exchange
ETIMEDOUT (Operation timed out): A connect or send request failed because the connected party did not properly respond after a period of time....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found