Getting http-status="401", code = 3 when uploading file in iOS. In Android it works fine.
usamasharif opened this issue · 4 comments
Bug Report
Problem
Getting http-status="401", code = 3 when uploading file in iOS.
What is expected to happen?
It should submit the file to server as it is working in Android.
What does actually happen?
It gives the error below when submitted in iOS.
FileTransferError {
body = "[]";
code = 3;
"http_status" = 401;
source = "file:///var/mobile/Containers/Data/Application/9A7C2CF0-6DF7-4878-B0A9-5DEE99047652/Documents/637584019181140096_question.png";
target = "https://acceptance-nl.castoredc.org/api/study/F43BFEEC-588F-4E8A-BC26-6A974B83D08B/record/000842/data-point/survey/85E4F1D1-6219-4CAC-A248-7AEE91023221/9C245F0C-5573-45BC-80EB-BF97D17F7F73";
}
Information
const fileTransfer = this.fileTransfer.create();
const options: FileUploadOptions = {
fileKey: 'upload_file',
fileName: 'image.jpeg',
httpMethod: 'POST',
mimeType: 'image/jpeg',
headers: {
Accept: '*/*',
...(secure && { Authorization: `Bearer ${await this.storageSvc.get<string>(STORAGE_TOKEN, true)}` }),
},
params: { ...params },
};
return fileTransfer.upload(filePath, `${this._apiRoot}api/${uri}`, options);
Environment, Platform, Device
Ionic:
Ionic CLI : 6.14.1 (/Users/usama/.nvm/versions/node/v14.15.4/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.5.4
@angular-devkit/build-angular : 0.901.14
@angular-devkit/schematics : 11.2.1
@angular/cli : 9.1.14
@ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : android 9.0.0, ios 6.2.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, cordova-plugin-ionic 5.4.7, (and 16 other plugins)
Utility:
cordova-res : 0.15.3
native-run : 1.3.0
System:
Android SDK Tools : 26.1.1 (/Users/usama/Library/Android/sdk/)
ios-deploy : 1.11.4
ios-sim : 8.0.2
NodeJS : v14.15.4 (/Users/usama/.nvm/versions/node/v14.15.4/bin/node)
npm : 6.14.10
OS : macOS Big Sur
Xcode : Xcode 12.5 Build version 12E262
Hi, same bug. It appears on production environment only, in local dev, all works fine. Do you find a solution ?
Hi, i get the same bug, in my case i got this bug in IOS 14.6
I get this bug in Android also. Can you please help me out in this?