-
Notifications
You must be signed in to change notification settings - Fork 23
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
Progress UploadStates no longer emitted #147
Comments
Hi @Spiral1401! I can't reproduce it yet.
There's no "speed" field , which means that either there's no real content upload or there's something wrong with |
That's interesting, I didn't catch the missing "speed" field. However like I said the upload is working perfectly otherwise - I can breakpoint and see the contents through the chain - and when it completes I can browse for it in our Azure Storage and download the resultant file. The problem seems to exist regardless of if I override the default uploaderClass with my own implementation, but here is what mine looks like:
It was based on an earlier version of the library default uploader. My server response is set up to send back a 308 response with no "Range" header when ngx-uploadx is asking for the offset (and there isn't one). Hence why I do what I do in "getValueFromResponseCust". But I can also make the server send back "Range: bytes=0--1" for that scenario and allow it to work with the default class rather than my version. Here's what the logging looks like for my uploader class and it's console.log statements:
*Another difference in my server response when using my own uploader class is that the response is the range written for that particular request i.e. "range: bytes=6291456-8388607" rather than "range: bytes=0-8388607" ("all that has been written") with the default class, but I can make it work either way - and the issue persists in both scenarios. |
Yeah, it'll force the progress events: async sendFileContent(): Promise<number> {
// ...
const _ = await this.request({
method: 'PUT',
body,
url: this.url,
headers,
progress: true // <--- force progress events
});
console.log(this._xhr.upload.onprogress); // should never be null
// ...
} |
Unfortunately I'm not seeing a difference. Here's my updated sendFileContent():
(I printed out a slightly different object to avoid console.logging the entire body contents) And the resulting logs:
|
You need at least v3.3.1 or copy |
I am using ngx-uploadx 3.3.3. I mention in the original post that I started with 3.1.4 but I already upgraded to latest in an attempt to fix the issue. Tried copying the request method from ngx-uploadx source into my UploaderXCustom class anyway but things in the base Uploader class being private (onProgress(), startTime, stateChange() ) are making it tricky to do without copying several other things into my own class. Have to switch gears on my end for a few hours at least but I'll jump back on this soon. Appreciate your help. |
Actually, I think I just found the issue. It fits too perfectly. And I only just started using the service worker semi recently in this particular app, so it lines up time-wise as well. ng serve does not use the angular service worker, while all the other methods of running the app I am using do. So... this has to be it. And I imagine, there is nothing you can do to fix it - but it looks like I can modify my service worker configuration to allow it to work. I'll try to drop some further info in here if I get the fix working (might help with documenting it for other people). |
Angular service worker provides a header to allow requests to bypass being handled by it. Mentioned here: Modified the headers in the sendFileContent() of my custom Uploader class:
Also (somewhat beside the point) had to edit my serverside web.config "Access-Control-Allow-Headers" to include "ngsw-bypass". Tested and working, progress events are happening again. |
Describe the bug
This is a strange one, this hasn't been a problem until very recently but also not sure exactly when it began.
Only happens for configuration/AOT built angular (ie ng build --configuration=dev etc.). Doesn't happen when using app via "ng serve".
I use PrimeNG's fileupload component combined with ngx-uploadx UploadService.
Did some simple debugging with console.log messages:
When local via ng serve (this is where things work normally):
When running via angular-http-server on a ng build --configuration=dev build (AOT, etc.):
For some reason the progress events are skipped right over. Also happens on our deployed Azure DEV environment. It otherwise behaves exactly as it should - the same number of requests, responses, chunks, etc. Just no progress states emitted. Basically the only issue is my progress bar UI no longer shows anything. It just sits at 0% until final chunk is sent when it jumps to 100%.
At first I tried reverting to the default uploaderClass (I had it overridden with my own) by not defining one in UploadxOptions - and altered my server responses to be compatible. No luck.
Then I updated ngx-uploadx from 3.1.4 to 3.3.3. No luck.
To Reproduce
Not sure it'd be worth trying to reproduce my exact scenario as it's kind of involved, more looking for advice / whether anyone has seen anything like this.
Setup details:
ngx-uploadx
: 3.1.4 (later updated to 3.3.3)Additional context
Strangely seems independent of any relevant version changes/etc., but not 100% sure here.
The text was updated successfully, but these errors were encountered: