react-native-aws3 icon indicating copy to clipboard operation
react-native-aws3 copied to clipboard

Error :- read failed: EBADF (Bad file descriptor) when upload image.

Open Ektasahusahu opened this issue 5 years ago • 2 comments

image object contain uri path :

**{
name:"6ca129ac-8a07-4838-b141-cd25126b250b"
type:"image/jpeg"
uri:"content://com.vider/external_files/Pictures/images/image-647ec492-7149-4f13-822a-4e95dc053c9e.jpg"
}**

complete source code: const options = { keyPrefix: storagePath, bucket: 'wigbucket', region: 'us-east-1', accessKey: accessKey, secretKey: secretKey, successActionStatus: 201, // dirName: 'dev/profiles', // contentType: file.type, }; const fileObject = { uri: file.uri,//file://${file.path}`, name: uuidv4(), type: file.type, };

console.log('fileObject======>ekta', fileObject, options);
return  RNS3.put(file, options)
.then(response => {
  if (response.status !== 201)
    throw new Error("Failed to upload image to S3");
  else {
    console.log(
      "Successfully uploaded image to s3. s3 bucket url: ",
      response.body.postResponse.location
    );
  }
})
.catch(error => {
  console.log(error);
});`

Ektasahusahu avatar Apr 17 '20 12:04 Ektasahusahu

Got the same issue on Android sdk - 22. read failed: EBADF (Bad file descriptor) while uploading jpg. Spent a full day to verify every thing, from permissions on mobile to permission on aws, but still getting the error.

rajeevnodzon avatar Jun 22 '20 16:06 rajeevnodzon

Seems like this package doesn't works with RN > 60.

rajeevnodzon avatar Jun 23 '20 08:06 rajeevnodzon