NativeScript IOS: Photo uploads to server are randomly failing with slow networks(LTE 1 or 2 bars)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- angular, ios, typescript
- Lĩnh vực
- api, mobile, networking
Hướng nghiên cứu
Bắt đầu với các đoạn mã uploadPhotos, submitPhoto và upload được cung cấp, sau đó tái hiện trên iOS 17.2 với LTE ở mức 1–2 vạch trong khi kiểm tra trạng thái 0 của HttpErrorResponse. So sánh đường dẫn upload forkJoin/zip với trường hợp thành công khi mạng mạnh và ghi lại nguyên nhân cùng cách khắc phục đã được xác minh ở phía client hoặc phía server.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Nativescript version - 8.4.7, Angular 15, IOS 17.2
When uploading photos to server/Microsoft api in the slow network (LTE 1 or 2 bars). The photos are not uploading and returning below exception. Looks like the request is not even reaching the server.
error
{
"headers": {
"normalizedNames": {},
"lazyUpdate": null,
"headers": {}
},
"status": 0,
"statusText": "Unknown Error",
"url": "https://abc",
"ok": false,
"name": "HttpErrorResponse",
"message": "Http failure response for "https://abc": 0 Unknown Error",
"error": {}
}
When connected to a strong network LTE 3 or more bars ,5g or WIFI , I am able to upload more than 50 photos at once without any issues.
Here is my upload code
//component
uploadPhotos(): void {
let message;
this.parent = this.service.getPhotosToUpload();
if (this.parent !== null && this.parent.length > 0) {
const parentList$ = new Array<Observable<boolean[]>>;
this.parent.forEach(p=> {
const observable = this.submitPhoto(p)
if (observable) {
parentList$.push(observable);
}
});
zip(parentList$)
.pipe(
switchMap((flags: boolean[][], index: number) => {
let totalNotuploaded = 0;
let totalUploaded = 0;
const results =[]
flags.forEach((flag) => {
totalNotuploaded += flag.filter(falses => !falses).length;
totalUploaded += flag.filter(trues => trues).length;
});
results.push([totalNotuploaded, totalUploaded])
return of(results);
})
).subscribe((results: number[][]) => {
let notuploaded = results[0][0] ;
let uploaded = results[0][1];
this.message = `Uploaded ${uploaded} Photo(s).`;
if (notuploaded > 0) {
this.message += `Errors uploading ${notuploaded}`
}
});
} else {
this.message = `Uploaded 0 Photos.`;
}
}
submitPhoto(photo: PhotoWrapper): Observable<boolean[]> {
const photosToUpload$ = new Array<Observable<boolean>>();
const photosToUpload = photo.filter((filter) => !filter.Uploaded);
photosToUpload.forEach(photo => {
photo.FileContent = this.servic.getFileAsBase64String(new Path(photo.File.directory as any, photo.File.relativePath));
const observable = this.service.upload(photo);
photosToUpload$.push(
observable.pipe(
catchError(() => {
return of(null)
}),
switchMap((result: PhotoResult) => {
return of(result && result?.flag ? true : false)
})
));
});
if (photosToUpload$ && photosToUpload$.length) {
return forkJoin(photosToUpload$);
} else { return null; }
}
//upload service
upload(photosData: PhotoWrapper): Observable<PhotoResult> {
let headers = this.authService.getAuthHeader();
let url = this.configurationService.uploadPhotoUrl();
return this.http.post<boolean>(this.configurationService.uploadPhotoUrl(), photoDto, { headers: headers, observe: 'response' }).pipe(
map((result) =>( {flag: result.body, wrapper: photosData} as PhotoResult)),
);
}
}
can anyone help me on how to fix this issue or is there any setting on the ios/nativescript/angular side which will prevent this to happen or is something wrong with my upload code?
- Ngôn ngữ chính
- TypeScript
- Star
- 206
- Fork
- 123
- Merge trung bình
- 2 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NativeScript/plugins
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
NativeScript/plugins#680 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NativeScript/plugins#671 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
NativeScript/plugins#640 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
NativeScript/plugins#668 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
NativeScript/plugins#665 · 1 bình luận ·
Tất cả issue của NativeScript/plugins
Issue tương tự
-
comp/dashboard P3 type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
NousResearch/hermes-agent#117722 ·
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
-
code-quality refactoring
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
langchain-ai/deepagents#6450 ·