-
Notifications
You must be signed in to change notification settings - Fork 25.7k
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
Document service workers don't support upload progress for httpClient reportProgress
#24683
Comments
Here is the relevant feature spec that will add support fetch upload progress. It seems a ways off so docs would be good until then. It's called |
@epelc Thanks for this research and clarification. I'm checking with engineering to ensure that they agree this is a useful/correct doc addition. |
@jenniferfell this is a useful addition, albeit an esoteric one. |
It would be great if there is a possibility to configure the http request or the service worker not to intercept specific requests. Like mention in the #25007 |
Since when are file uploads esoteric? Browser and library authors need to treat file uploads as a first class citizen. Literally every line of business app has some form of attachment upload. |
@tzahari onFetch(event) {
if (event.request.url.indexOf('upload') !== -1) {
return;
}
...
} You can check out this article for more information. |
Is there any workaround other than modifying Thanks. |
@FreakTheMighty thanks for the link. To be clear see the pr for that issue 6200732 There are now docs about setting a special header or other flags to bypass the service worker entirely for specific requests. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a...
Current behavior
I believe service workers do not support reporting upload progress(download progress should work) since it basically acts as a proxy and converts all
XMLHttpRequest
s to the fetch api. This should be documented to avoid confusion. I just spent several hours trying to figure out why upload progress doesn't work when you use service workers.Some more info on why:
Service workers act as a proxy for all requests
Requests come in as XmlHttpRequest or fetch and are always sent out to your server as a fetch request.
This can't be changed since service workers only support using the newer fetch api
Fetch doesn't support upload progress(it's not in the spec yet)
the first uses xhr(XMLHttpRequest) but goes out of the service worker as a fetch request which is why you can’t get upload progress info
Expected behavior
Basically the docs should state that
reportProgress
doesn't work when using a service worker due to fetch api limitations.Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Documenting this would make using service workers less confusing. Without these docs you have to dig deep and understand/know about more internals for XmlHttpRequest, fetch, how service workers actually work, etc.
Environment
The text was updated successfully, but these errors were encountered: