pcace
pcace

Reputation: 662

axios timeouts without any reason?

I'm trying to use axios to download this file (and headers): http://daten-hamburg.de/opendata/3d_stadtmodell_lod2/LoD2-DE_HH_2023-04-01.zip using this getlastModified function:

axiosRetry(axios, {
  retries: 10,
  retryDelay: axiosRetry.exponentialDelay,
  onRetry: (retryCount, error, requestConfig) => {
    log.warn(`Retry attempt #${retryCount} for ${requestConfig.url}`)
  },
})


export const getlastModified = async (url: string) => {
  try {
    const response = await axios.head(url, {
      timeout: 20000,
    }) // 20 seconds timeout
    const lastModified = response.headers['last-modified']
    log.debug(response.headers)
    const date = new Date(lastModified)
    return date
  } catch (error) {
    console.error(`Error fetching headers: ${error}`)
    return undefined
  }
}

Strangely, this works on one machine, but not on another even though both have exactly the same axios version and running: curl -I http://daten-hamburg.de/opendata/3d_stadtmodell_lod2/LoD2-DE_HH_2023-04-01.zip also works on both.

The versions used (from package.json) are:

"axios": "^1.7.7",
"axios-retry": "^4.5.0",

How can I figure out why this times out on one machine (with very fast internet) whilst it does not on the other (which uses a standard cable connection)?

Thanks a lot for ideas,

Cheers

PS: I've found one more thing: I can download the file with curl, but I cannot with wget which hangs when trying to connect to the server. What is going on here?

Upvotes: 0

Views: 56

Answers (0)

Related Questions