Mink icon indicating copy to clipboard operation
Mink copied to clipboard

Aggregator fall-through does not work on an HTTP 502

Open machawk1 opened this issue 3 years ago • 7 comments

The default aggregator at memgator.cs.odu.edu is currently returning an HTTP 502. The logic for aggregator fall-through uses fetch, which will not invoke the catch to handle the error, thus the flow never resolves.

fetch should be returning a promise. We are returning window.fetch but somehow detection of this broken promise is not caught in the instance of this HTTP status code. Timely handling of this issue is needed before the default aggregator becomes alive again.

machawk1 avatar Jun 22 '22 21:06 machawk1

Maybe because we are using the built built-in aborter in content.js?

return window.fetch(url, options)
  .then(setTimeout(() => { aborter.abort() }, timeout))
  .catch(error => {
    log(`${url} appears to be down, incrementing host counter`)
    log(error)
    hostI += 1
  })

machawk1 avatar Jun 22 '22 21:06 machawk1

The 502 is likely occurring before the AbortController fires, hence no catch.

machawk1 avatar Jun 22 '22 21:06 machawk1

There is nothing in the associated then (when added) that I am able to tell that distinguishes a successful response from a failed (502).

machawk1 avatar Jun 22 '22 21:06 machawk1

XHR is not a solution here, as fetch will only be allowed in manifest v3. (#316)

machawk1 avatar Jun 22 '22 22:06 machawk1

"Fetch detects only network errors. Other errors (4xx, 5xx) should be manually caught and rejected."

machawk1 avatar Jun 22 '22 22:06 machawk1

The ODUCS aggregator is alive again and this issue is not yet fixed. A mock would be useful here for testing.

machawk1 avatar Jun 30 '22 20:06 machawk1

See #316 for some additional work on this front in adapting the extension to MV3.

machawk1 avatar Aug 24 '23 19:08 machawk1