-
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
Infinite retries upon 500 response #297
Comments
I tried this code:
const options = new DiskStorage({
directory: 'upload'
});
app.use('/upload/files', uploadx.upload(options), (req, res) => {
res.sendStatus(500);
});
@Component({
selector: 'app-service-way',
templateUrl: './service-code-way.component.html'
})
export class ServiceCodeWayComponent implements OnDestroy, OnInit {
state$!: Observable<UploadState>;
uploads: Ufile[] = [];
numberOfCopies = 0;
@ViewChild('file', { read: ElementRef })
fileInput!: ElementRef;
private unsubscribe$ = new Subject();
constructor(private uploadService: UploadxService) {}
onChange(): void {
const files = this.fileInput.nativeElement.files;
for (let i = 0; i < files.length; i++) {
this.uploadService.handleFiles(files[i], {
endpoint: `${environment.api}/upload/files`,
multiple: false,
token: 'token'
});
}
}
ngOnInit(): void {
this.state$ = this.uploadService.init();
this.state$.pipe(takeUntil(this.unsubscribe$)).subscribe(state => {
const file = this.uploads.find(item => item.uploadId === state.uploadId);
file ? file.update(state) : this.uploads.push(new Ufile(state));
});
}
... Couldn't catch the error. sendFileContent() and getOffset() should always reject at code 500. Only In |
Sorry, I wasn't clear enough. The issue appears when a 500 is returned when the file upload is completed. |
Is it possible to test with this server code (with correct PATH and PORT)? const express = require('express');
const { uploadx } = require('node-uploadx');
//
const PATH = '/api/v1/videos/upload';
const PORT = 3003;
//
const app = express();
let retries = 0;
app.use(PATH, uploadx.upload({ directory: 'upload' }), (req, res) => {
return res.status(500).json({ message: `is something wrong, ${retries++}` });
});
app.listen(PORT, () => console.log('listening on port:', PORT)); P.S. |
I cannot reproduce either, but it would be convenient to have a |
Describe the bug
When the server returns 500 upon file upload (PUT request) there's infinite retries.
To Reproduce
And then return 500 when the last part has been uploaded.
Expected behavior
A clear and concise description of what you expected to happen.
Setup details:
ngx-uploadx
: 4.0.2Additional context
When I'm debugging the code it looks like line 136 is reached before the server responded with 500.
ngx-uploadx/src/uploadx/lib/uploader.ts
Lines 131 to 136 in 8213d9f
The text was updated successfully, but these errors were encountered: