Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: connect ETIMEDOUT #31737

Closed
Quernest opened this issue Jun 2, 2021 · 7 comments
Closed

Error: connect ETIMEDOUT #31737

Quernest opened this issue Jun 2, 2021 · 7 comments
Labels
stale? Issue that may be closed soon due to the original author not responding any more. topic: source-wordpress Related to Gatsby's integration with WordPress type: bug An issue or pull request relating to a bug in Gatsby

Comments

@Quernest
Copy link

Quernest commented Jun 2, 2021

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!

@Quernest Quernest added the type: bug An issue or pull request relating to a bug in Gatsby label Jun 2, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jun 2, 2021
@LekoArts LekoArts added status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. topic: source-wordpress Related to Gatsby's integration with WordPress and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jun 4, 2021
@LekoArts
Copy link
Contributor

LekoArts commented Jun 4, 2021

Hi!

Sorry to hear you're running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you're able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.

If you're up for it, we'd very much appreciate if you could provide a minimal reproduction and we'll be able to take another look.

Thanks for using Gatsby! 💜

@ThyNameIsMud
Copy link
Contributor

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.

@div-cowboy
Copy link

@ThyNameIsMud could you plz recommend a way I can implement a temporary fix to the plugin in my local plugins folder? Would love to throw a bandaid on this until it is addressed

@ThyNameIsMud
Copy link
Contributor

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

@TylerBarnes
Copy link
Contributor

@ThyNameIsMud that's really good to know. The createRemoteFileNode helper was forked in the WP package to fix some issues with it and the fixes were never added back to the main copy of it. We'll be refocusing efforts on the WP plugin in the next couple months and will likely move back to using the main helper instead of the forked one at that time.

gatsbybot pushed a commit that referenced this issue Jun 11, 2021
…31847)

* fix(gatsby-source-wordpress) Use send method for timeout and allow overrides for timeouts (#31737)

* fix(gatsby-source-wordpress) Validation for get remote file env vars

* fix(gatsby-source-wordpress) typo fix

Co-authored-by: Louis Weber <lweber@riversagency.com>
@LekoArts LekoArts removed the status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. label Jun 21, 2021
@github-actions
Copy link

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Jul 11, 2021
@github-actions
Copy link

Hey again!

It’s been 60 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.
Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to comment on this issue or create a new one if you need anything else.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more. topic: source-wordpress Related to Gatsby's integration with WordPress type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

5 participants