Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

Retry request on ETIMEDOUT #166

Closed
@kaganjd

Description

@kaganjd

- Do you want to request a feature or report a bug?
feature? enhancement?

- What is the current behavior?
We have an enterprise customer who's hitting errors like this (redacted for privacy) a few times every day, impacting 5-10% of their daily builds:

FetchError: request to https://api.netlify.com/api/v1/sites/xxxxxxx-xxxxxxx failed, reason:
    connect ETIMEDOUT 3x.xxx.xx.xxx:443
    Code: ETIMEDOUT

@kitop investigated and found that the error was coming from node-fetch. He says:

Seems like that's happening because one of the requests from the client fails to connect to the API servers when polling for the deploy being ready. Some related issue: node-fetch/node-fetch#817
If I turn on my wifi and try to run a command from CLI it shows a similar error

Request
Can we retry when there's a timeout like this? It looks like we currently retry when hitting a rate limit but not when there's a network issue:

const makeRequestOrRetry = async function({ url, method, NetlifyApi, requestParams, opts }) {
for (let index = 0; index <= MAX_RETRY; index++) {
const optsA = getOpts(method, NetlifyApi, requestParams, opts)
const response = await makeRequest(url, optsA)
if (shouldRetry(response, index)) {
await waitForRetry(response)
} else {
return response
}
}
}
const makeRequest = async function(url, opts) {
try {
return await fetch(url, opts)
} catch (error) {
throw getFetchError(error, url, opts)
}
}

Additional context

Metadata

Metadata

Labels

on-callprioritized tasks for the team's on-call persontype: bugcode to address defects in shipped code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions