Skip to content
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

Getting http-status="401", code = 3 when uploading file in iOS. In Android it works fine. #304

Open
usamasharif opened this issue Jun 4, 2021 · 4 comments

Comments

@usamasharif
Copy link

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

@sKuD51
Copy link

sKuD51 commented Jul 28, 2021

Hi, same bug. It appears on production environment only, in local dev, all works fine. Do you find a solution ?

@RamiserjTankian
Copy link

Hi, i get the same bug, in my case i got this bug in IOS 14.6

@sKuD51
Copy link

sKuD51 commented Aug 11, 2021 via email

@amitgharge-amyth
Copy link

amitgharge-amyth commented Nov 15, 2023

I get this bug in Android also. Can you please help me out in this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants